/** * Constructor. * * @param AbstractViewHelper $viewHelper The view helper * @param array $arguments<NodeInterface> Arguments of view helper - each value is a RootNode. */ public function __construct(AbstractViewHelper $viewHelper, array $arguments) { $this->uninitializedViewHelper = $viewHelper; $this->viewHelpersByContext = new \SplObjectStorage(); $this->arguments = $arguments; $this->viewHelperClassName = $this->uninitializedViewHelper instanceof DependencyProxy ? $this->uninitializedViewHelper->_getClassName() : get_class($this->uninitializedViewHelper); }
/** * @test */ public function processDisablesEscapingInterceptorIfViewHelperDisablesIt() { $interceptorPosition = \TYPO3\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER; $this->mockViewHelper->expects($this->once())->method('isEscapingInterceptorEnabled')->will($this->returnValue(FALSE)); $this->mockNode->expects($this->once())->method('getUninitializedViewHelper')->will($this->returnValue($this->mockViewHelper)); $this->assertTrue($this->escapeInterceptor->_get('interceptorEnabled')); $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState); $this->assertFalse($this->escapeInterceptor->_get('interceptorEnabled')); }
/** * @test */ public function processReenablesEscapingInterceptorOnClosingViewHelperTagIfItWasDisabledBefore() { $interceptorPosition = InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER; $this->mockViewHelper->expects($this->any())->method('isOutputEscapingEnabled')->will($this->returnValue(false)); $this->mockNode->expects($this->any())->method('getUninitializedViewHelper')->will($this->returnValue($this->mockViewHelper)); $this->escapeInterceptor->_set('childrenEscapingEnabled', false); $this->escapeInterceptor->_set('viewHelperNodesWhichDisableTheInterceptor', array($this->mockNode)); $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState); $this->assertTrue($this->escapeInterceptor->_get('childrenEscapingEnabled')); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('theme', 'string', 'The name of a gallery theme', false); $this->registerArgument('imageVariant', 'string', 'The name of a defined resolution', false); $this->registerArgument('key', 'string', 'The key of meta data array', false); }
/** * @param \TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper * @return void */ protected function injectDependenciesIntoViewHelper(\TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper) { $viewHelper->setRenderingContext($this->renderingContext); $viewHelper->setArguments($this->arguments); if ($viewHelper instanceof \TYPO3\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper) { $viewHelper->injectTagBuilder($this->tagBuilder); } }
/** * Sets the tag name to $this->tagName. * Additionally, sets all tag attributes which were registered in * $this->tagAttributes and additionalArguments. * * Will be invoked just before the render method. * * @return void * @api */ public function initialize() { parent::initialize(); $this->tag->reset(); $this->tag->setTagName($this->tagName); if ($this->hasArgument('additionalAttributes') && is_array($this->arguments['additionalAttributes'])) { $this->tag->addAttributes($this->arguments['additionalAttributes']); } if (isset(self::$tagAttributes[get_class($this)])) { foreach (self::$tagAttributes[get_class($this)] as $attributeName) { if ($this->hasArgument($attributeName) && $this->arguments[$attributeName] !== '') { $this->tag->addAttribute($attributeName, $this->arguments[$attributeName]); } } } }
/** * Merges the TYPO3.Ice settings with the current settings before calling the render() method * * @return string */ public function initializeArgumentsAndRender() { $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Ice'); if ($this->controllerContext->getRequest()->getControllerPackageKey() !== 'TYPO3.Ice') { $packageSettings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->controllerContext->getRequest()->getControllerPackageKey()); if (!empty($packageSettings['extendIceSettings'])) { $settings = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $packageSettings); } else { $settings = $packageSettings; } } if (isset($settings['projectElementTypes'])) { $supertypeResolver = new \TYPO3\Ice\Utility\SupertypeResolver($settings['projectElementTypes']); $settings['projectElementTypes'] = $supertypeResolver->getCompleteMergedTypeDefinition(TRUE); } $this->settings = $settings; return parent::initializeArgumentsAndRender(); }
/** * Initialize arguments. * * @return void * @api */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('node', 'object', 'Associative array with childnode objects'); $this->registerArgument('as', 'string', 'name of returned variable'); }
/** * Initialize arguments. * * @return void * @api */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('node', 'object', 'Categories Array'); $this->registerArgument('as', 'string', 'Category Object'); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); // @deprecated since 2.0 use the "image" argument instead $this->registerArgument('asset', AssetInterface::class, 'The image to be rendered - DEPRECATED, use the "image" argument instead', false); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); // @deprecated since 2.0 use the "image" argument instead $this->registerArgument('asset', 'TYPO3\\Media\\Domain\\Model\\AssetInterface', 'The image to be rendered - DEPRECATED, use "image" argument instead', false); }
/** * Initialize arguments. * * @return void * @api */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('contactIds', 'array', 'Id of Contact Person'); $this->registerArgument('as', 'string', 'name of returned variable'); }
/** * @param \TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper * @return void */ protected function injectDependenciesIntoViewHelper(\TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper) { $viewHelper->injectConfigurationManager($this->mockConfigurationManager); parent::injectDependenciesIntoViewHelper($viewHelper); }