Feature #46259

Hook to allow other files than images in css_styled_content

Added by Georg Ringer about 8 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2013-03-14
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

currently, css_styled_content can only handle images for "text with images".

however with FAL, more and more extensionss/users need a way to output other things.

#1

Updated by Gerrit Code Review about 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18893

#2

Updated by Ernesto Baschny about 8 years ago

While this sounds cool, do you have a use-case ready to test already for the new hook?

And speaking of "hooks", isn't the modern way of dealing with hooks to have an interface people can implement in order to maintain a certain signature for the hooks?

#3

Updated by Georg Ringer about 8 years ago

got a usecase but not ready to be public.

it is a new implementation of rgmediaimages which shows videos inside "text w image".

I am writing a new fal driver to deal with virtual files which are e.g. links to youtube. an editor can then add those files to the content element (this works already kind of) and now I need to deal with the output.

current class looks like this

<?php

class Tx_Falvirtual_Hooks_CssStyledContentController {

    /** @var TYPO3\CMS\CssStyledContent\Controller\CssStyledContentController */
    protected $parentObject;

    public function render($arguments, TYPO3\CMS\CssStyledContent\Controller\CssStyledContentController $parentObject) {
        $this->parentObject = $parentObject;
        $out = '';

        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($arguments['file'])) {

            $sysFile = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file', 'uid=' . (int)$arguments['file']);
            $storage = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file_storage', 'driver="falvirtual" AND uid=' . (int)$sysFile['storage']);

            if (!is_array($storage)) {
                return $out;
            }

            /** @var $configuration \GeorgRinger\Falvirtual\Domain\Model\Dto\Configuration */
            $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('GeorgRinger\\Falvirtual\\Domain\\Model\\Dto\Configuration');
            $configuration->setSysFile($sysFile);

            $this->getDimensions($configuration, $arguments['imageConfiguration']);

            // @todo implement factory
            /** @var $api \GeorgRinger\Falvirtual\Api\Youtube */
            $api = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('GeorgRinger\\Falvirtual\\Api\\Youtube');
            $out = $api->render($configuration);
        }

        return $out;
    }

    /**
     * Set the correct maximum dimensions to the configuration dto
     *
     * @param \GeorgRinger\Falvirtual\Domain\Model\Dto\Configuration $configuration
     * @param array $ts
     * @return void
     */
    protected function getDimensions(\GeorgRinger\Falvirtual\Domain\Model\Dto\Configuration &$configuration, array $ts) {
        unset($ts['file.']['import.']);
        $ts['file'] = 'EXT:falvirtual/Resources/Public/Images/dummy.png';
        list($width, $height) = getimagesize($this->parentObject->cObj->IMG_RESOURCE($ts));

        $configuration->setWidth($width);
        $configuration->setHeight($height);
    }
}

interfaces got also their drawbacks but I am open to those too. I can also use signalslots ;)

#4

Updated by Ernesto Baschny about 8 years ago

Sounds cool, Georg. Maybe SignalSlot is the way to go, as also other FAL activities already use this pattern. I am not sure yet if a connected slot is allowed to modify the incoming parameters, as it doesn't seem to be able to return any value to the signalling instance. I cannot find any documentation in this regard, do you know it?

#5

Updated by Georg Ringer about 8 years ago

Don't know it either

#6

Updated by Gerrit Code Review about 8 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18893

#7

Updated by Gerrit Code Review about 8 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18893

#8

Updated by Georg Ringer about 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#9

Updated by Riccardo De Contardi over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF