/** * Initializes the Object framework. * * @return void * @see initialize() */ public function initializeConfiguration($configuration) { $this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); $contentObject = isset($this->cObj) ? $this->cObj : \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $this->configurationManager->setContentObject($contentObject); $this->configurationManager->setConfiguration($configuration); }
/** * Adds a ViewHelper node using the Format\HtmlspecialcharsViewHelper to the given node. * If "escapingInterceptorEnabled" in the ViewHelper is FALSE, will disable itself inside the ViewHelpers body. * * @param \TYPO3\Fluid\Core\Parser\SyntaxTree\NodeInterface $node * @param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point * @param \TYPO3\Fluid\Core\Parser\ParsingState $parsingState the current parsing state. Not needed in this interceptor. * @return \TYPO3\Fluid\Core\Parser\SyntaxTree\NodeInterface */ public function process(\TYPO3\Fluid\Core\Parser\SyntaxTree\NodeInterface $node, $interceptorPosition, \TYPO3\Fluid\Core\Parser\ParsingState $parsingState) { if ($interceptorPosition === \TYPO3\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER) { if (!$node->getUninitializedViewHelper()->isEscapingInterceptorEnabled()) { $this->interceptorEnabled = FALSE; $this->viewHelperNodesWhichDisableTheInterceptor[] = $node; } } elseif ($interceptorPosition === \TYPO3\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER) { if (end($this->viewHelperNodesWhichDisableTheInterceptor) === $node) { array_pop($this->viewHelperNodesWhichDisableTheInterceptor); if (count($this->viewHelperNodesWhichDisableTheInterceptor) === 0) { $this->interceptorEnabled = TRUE; } } } elseif ($this->interceptorEnabled && $node instanceof \TYPO3\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode) { $escapeViewHelper = $this->objectManager->get('TYPO3\\Fluid\\ViewHelpers\\Format\\HtmlspecialcharsViewHelper'); $node = $this->objectManager->create('TYPO3\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', $escapeViewHelper, array('value' => $node)); } return $node; }
/** * @return void */ protected function initializeConcreteConfigurationManager() { $this->concreteConfigurationManager = $this->objectManager->get('TYPO3\\Fluid\\Configuration\\FrontendConfigurationManager'); }
/** * Initialize the given ViewHelper and adds it to the current node and to * the stack. * * @param \TYPO3\Fluid\Core\Parser\ParsingState $state Current parsing state * @param string $namespaceIdentifier Namespace identifier - being looked up in $this->namespaces * @param string $methodIdentifier Method identifier * @param array $argumentsObjectTree Arguments object tree * @return void */ protected function initializeViewHelperAndAddItToStack(\TYPO3\Fluid\Core\Parser\ParsingState $state, $namespaceIdentifier, $methodIdentifier, $argumentsObjectTree) { if (!array_key_exists($namespaceIdentifier, $this->namespaces)) { throw new \TYPO3\Fluid\Core\Parser\Exception('Namespace could not be resolved. This exception should never be thrown!', 1224254792); } $viewHelper = $this->objectManager->get($this->resolveViewHelperName($namespaceIdentifier, $methodIdentifier)); // The following three checks are only done *in an uncached template*, and not needed anymore in the cached version $expectedViewHelperArguments = $viewHelper->prepareArguments(); $this->abortIfUnregisteredArgumentsExist($expectedViewHelperArguments, $argumentsObjectTree); $this->abortIfRequiredArgumentsAreMissing($expectedViewHelperArguments, $argumentsObjectTree); $this->rewriteBooleanNodesInArgumentsObjectTree($expectedViewHelperArguments, $argumentsObjectTree); $currentViewHelperNode = $this->objectManager->create('TYPO3\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', $viewHelper, $argumentsObjectTree); $state->getNodeFromStack()->addChildNode($currentViewHelperNode); if ($viewHelper instanceof \TYPO3\Fluid\Core\ViewHelper\Facets\ChildNodeAccessInterface && !$viewHelper instanceof \TYPO3\Fluid\Core\ViewHelper\Facets\CompilableInterface) { $state->setCompilable(FALSE); } // PostParse Facet if ($viewHelper instanceof \TYPO3\Fluid\Core\ViewHelper\Facets\PostParseInterface) { // Don't just use $viewHelper::postParseEvent(...), // as this will break with PHP < 5.3. call_user_func(array($viewHelper, 'postParseEvent'), $currentViewHelperNode, $argumentsObjectTree, $state->getVariableContainer()); } $this->callInterceptor($currentViewHelperNode, \TYPO3\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER, $state); $state->pushNodeToStack($currentViewHelperNode); }