Feature #46259
closedHook to allow other files than images in css_styled_content
100%
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.
Updated by Gerrit Code Review almost 12 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
Updated by Ernesto Baschny almost 12 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?
Updated by Georg Ringer almost 12 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 ;)
Updated by Ernesto Baschny almost 12 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?
Updated by Gerrit Code Review almost 12 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18893
Updated by Gerrit Code Review almost 12 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18893
Updated by Georg Ringer almost 12 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f86060fd299bf874bf8f182b82cb14eb58819c4a.
Updated by Riccardo De Contardi over 7 years ago
- Status changed from Resolved to Closed