get(RenderingContext::class, $this); } parent::__construct($context); } /** * Tells if the view implementation can render the view for the given context. * * By default we assume that the view implementation can handle all kinds of * contexts. Override this method if that is not the case. * * @param \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext Controller context which is available inside the view * @return bool TRUE if the view has something useful to display, otherwise FALSE */ public function canRender(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext) { return true; } /** * Sets the current controller context * * @param \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext * @internal */ public function setControllerContext(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext) { $request = $controllerContext->getRequest(); $this->controllerContext = $controllerContext; $this->baseRenderingContext->getTemplatePaths()->fillDefaultsByPackageName($request->getControllerExtensionKey()); $this->baseRenderingContext->getTemplatePaths()->setFormat($request->getFormat()); if ($this->baseRenderingContext instanceof RenderingContext) { $this->baseRenderingContext->setControllerContext($controllerContext); } } /** * @param string $templateName * @internal */ public function setTemplate($templateName) { $this->baseRenderingContext->setControllerAction($templateName); } /** * Sets the path and name of of the template file. Effectively overrides the * dynamic resolving of a template file. * * @param string $templatePathAndFilename Template file path */ public function setTemplatePathAndFilename($templatePathAndFilename) { $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename); } /** * Set the root path(s) to the templates. * If set, overrides the one determined from $this->templateRootPathPattern * * @param string[] $templateRootPaths Root path(s) to the templates. If set, overrides the one determined from $this->templateRootPathPattern */ public function setTemplateRootPaths(array $templateRootPaths) { $this->baseRenderingContext->getTemplatePaths()->setTemplateRootPaths($templateRootPaths); } /** * Resolves the template root to be used inside other paths. * * @return string[] Path(s) to template root directory */ public function getTemplateRootPaths() { return $this->baseRenderingContext->getTemplatePaths()->getTemplateRootPaths(); } /** * Set the root path(s) to the partials. * If set, overrides the one determined from $this->partialRootPathPattern * * @param string[] $partialRootPaths Root paths to the partials. If set, overrides the one determined from $this->partialRootPathPattern */ public function setPartialRootPaths(array $partialRootPaths) { $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths); } /** * Returns the absolute path to the folder that contains Fluid partial files * * @return string[] Fluid partial root paths * @throws InvalidTemplateResourceException */ public function getPartialRootPaths() { return $this->baseRenderingContext->getTemplatePaths()->getPartialRootPaths(); } /** * Resolves the layout root to be used inside other paths. * * @return string[] Fluid layout root paths * @throws InvalidTemplateResourceException */ public function getLayoutRootPaths() { return $this->baseRenderingContext->getTemplatePaths()->getLayoutRootPaths(); } /** * Set the root path(s) to the layouts. * If set, overrides the one determined from $this->layoutRootPathPattern * * @param string[] $layoutRootPaths Root path to the layouts. If set, overrides the one determined from $this->layoutRootPathPattern */ public function setLayoutRootPaths(array $layoutRootPaths) { $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths); } }