Giter VIP home page Giter VIP logo

Comments (1)

Teisi avatar Teisi commented on August 26, 2024

Sry i don't know how we can nest the dataProcessing thing correctly.
But you can try to use a custom viewhelper like this one below:

<?php
namespace HauerHeinrich\HhVideoExtender\ViewHelpers;

/***************************************************************
 * Copyright notice
 *
 * (c) 2023 Christian Hackl
 * All rights reserved
 *
 * This script is part of the TYPO3 project. The TYPO3 project is
 * free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The GNU General Public License can be found at
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * This script is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * This copyright notice MUST APPEAR in all copies of the script!
 * Example
 * <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
 *   xmlns:hhve="http://typo3.org/ns/HauerHeinrich/HhVideoExtender/ViewHelpers"
 *   data-namespace-typo3-fluid="true">
 *
 *  <hhve:getPreviewImage as="previewImage" uid="154" />
 */

// use \TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use \TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use \TYPO3\CMS\Core\Utility\GeneralUtility;

class GetPreviewImageViewHelper extends AbstractViewHelper {
    public function initializeArguments() {
        $this->registerArgument('as', 'string', 'The name of the iteration variable', false, 'hhvideoextender');
        $this->registerArgument('uid', 'int', 'Uid of the file / media which has the preview image attached.', false);
    }

    /**
     * @param array $arguments
     * @param \Closure $renderChildrenClosure
     * @param RenderingContextInterface $renderingContext
     *
     * @return string
     */
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) {
        $templateVariableContainer = $renderingContext->getVariableProvider();
        $uid = $arguments['uid'];

        if(empty($uid) || !\is_numeric($uid)) {
            return '';
        }

        $fileRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileRepository::class);
        $fileObjects = $fileRepository->findByRelation('sys_file_reference', 'preview_image', $uid);

        $output = '';
        $templateVariableContainer->add($arguments['as'], $fileObjects);
        $output .= $renderChildrenClosure();

        return $output;
    }
}

from hh_video_extender.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.