/** * RenderingContext constructor. * * @param ViewInterface $view * @param array $options */ public function __construct(ViewInterface $view, array $options = []) { parent::__construct($view); $this->setTemplateParser(new TemplateParser()); $this->setViewHelperResolver(new ViewHelperResolver()); $this->setTemplateProcessors([new EscapingFlagProcessor(), new NamespaceDetectionTemplateProcessor()]); $this->setTemplatePaths(new TemplatePaths($options)); $this->setVariableProvider(new TemplateVariableContainer()); }
/** * @param ViewInterface $view */ public function __construct(ViewInterface $view = null) { if ($view !== null) { // Note: if $view is received here this indicates internal framework instancing // and it is safe to call the parent constructor. Custom, non-view-providing // usages will only perform the initialisation below (which is sufficient mind you!) parent::__construct($view); } else { // Reproduced partial initialisation from parent::__construct; minus the custom // implementations we attach below. $this->setTemplateParser(new TemplateParser()); $this->setTemplateCompiler(new TemplateCompiler()); $this->setViewHelperInvoker(new ViewHelperInvoker()); $this->setViewHelperVariableContainer(new ViewHelperVariableContainer()); } $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $this->setTemplatePaths($objectManager->get(TemplatePaths::class)); $this->setViewHelperResolver($objectManager->get(ViewHelperResolver::class)); $this->setVariableProvider($objectManager->get(CmsVariableProvider::class)); $this->setTemplateProcessors(array_merge(parent::getTemplateProcessors(), [$objectManager->get(XmlnsNamespaceTemplatePreProcessor::class)])); /** @var FluidTemplateCache $cache */ $cache = $objectManager->get(CacheManager::class)->getCache('fluid_template'); if (is_a($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['fluid_template']['frontend'], FluidTemplateCache::class, true)) { $this->setCache($cache); } }