‪TYPO3CMS  11.5
AbstractTemplateView.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
23 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
24 use TYPO3Fluid\Fluid\View\AbstractTemplateView as Typo3FluidAbstractTemplateView;
25 use TYPO3Fluid\Fluid\View\Exception\InvalidTemplateResourceException;
26 
34 abstract class ‪AbstractTemplateView extends Typo3FluidAbstractTemplateView implements ‪ViewInterface
35 {
40  protected ‪$controllerContext;
41 
47  public function ‪initializeView() {}
48 
52  public function ‪__construct(?RenderingContextInterface $context = null)
53  {
54  if (!$context) {
55  $context = GeneralUtility::makeInstance(RenderingContextFactory::class)->create();
56  }
57  parent::__construct($context);
58  }
59 
71  {
72  trigger_error('Method ' . __METHOD__ . ' has been deprecated in v11 and will be removed with v12.', E_USER_DEPRECATED);
73  return true;
74  }
75 
84  {
86  $this->controllerContext = ‪$controllerContext;
87 
88  // @todo: Move these two lines elsewhere when dropping the method
89  $this->baseRenderingContext->getTemplatePaths()->fillDefaultsByPackageName($request->getControllerExtensionKey());
90  $this->baseRenderingContext->getTemplatePaths()->setFormat($request->getFormat());
91 
92  if ($this->baseRenderingContext instanceof ‪RenderingContext) {
93  $this->baseRenderingContext->‪setRequest($request);
94  $this->baseRenderingContext->setControllerContext(‪$controllerContext);
95  }
96  }
97 
102  public function ‪setTemplate($templateName)
103  {
104  $this->baseRenderingContext->setControllerAction($templateName);
105  }
106 
113  public function ‪setTemplatePathAndFilename($templatePathAndFilename)
114  {
115  $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename);
116  }
117 
124  public function ‪setTemplateRootPaths(array $templateRootPaths)
125  {
126  $this->baseRenderingContext->getTemplatePaths()->setTemplateRootPaths($templateRootPaths);
127  }
128 
134  public function ‪getTemplateRootPaths()
135  {
136  return $this->baseRenderingContext->getTemplatePaths()->getTemplateRootPaths();
137  }
144  public function ‪setPartialRootPaths(array $partialRootPaths)
145  {
146  $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths);
147  }
148 
155  public function ‪getPartialRootPaths()
156  {
157  return $this->baseRenderingContext->getTemplatePaths()->getPartialRootPaths();
158  }
159 
166  public function ‪getLayoutRootPaths()
167  {
168  return $this->baseRenderingContext->getTemplatePaths()->getLayoutRootPaths();
169  }
170 
177  public function ‪setLayoutRootPaths(array $layoutRootPaths)
178  {
179  $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths);
180  }
181 }
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\$controllerContext
‪TYPO3 CMS Extbase Mvc Controller ControllerContext $controllerContext
Definition: AbstractTemplateView.php:39
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\setControllerContext
‪setControllerContext(ControllerContext $controllerContext)
Definition: AbstractTemplateView.php:82
‪TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext
Definition: ControllerContext.php:30
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\getLayoutRootPaths
‪string[] getLayoutRootPaths()
Definition: AbstractTemplateView.php:165
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\canRender
‪bool canRender(ControllerContext $controllerContext)
Definition: AbstractTemplateView.php:69
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\setTemplate
‪setTemplate($templateName)
Definition: AbstractTemplateView.php:101
‪TYPO3\CMS\Fluid\View\AbstractTemplateView
Definition: AbstractTemplateView.php:35
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\initializeView
‪initializeView()
Definition: AbstractTemplateView.php:46
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\getTemplateRootPaths
‪string[] getTemplateRootPaths()
Definition: AbstractTemplateView.php:133
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\getPartialRootPaths
‪string[] getPartialRootPaths()
Definition: AbstractTemplateView.php:154
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\setTemplatePathAndFilename
‪setTemplatePathAndFilename($templatePathAndFilename)
Definition: AbstractTemplateView.php:112
‪TYPO3\CMS\Extbase\Mvc\View\ViewInterface
Definition: ViewInterface.php:26
‪TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext\getRequest
‪TYPO3 CMS Extbase Mvc Request getRequest()
Definition: ControllerContext.php:86
‪TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory
Definition: RenderingContextFactory.php:51
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\setLayoutRootPaths
‪setLayoutRootPaths(array $layoutRootPaths)
Definition: AbstractTemplateView.php:176
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\setPartialRootPaths
‪setPartialRootPaths(array $partialRootPaths)
Definition: AbstractTemplateView.php:143
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Fluid\Core\Rendering\RenderingContext
Definition: RenderingContext.php:37
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\__construct
‪__construct(?RenderingContextInterface $context=null)
Definition: AbstractTemplateView.php:51
‪TYPO3\CMS\Fluid\View
Definition: AbstractTemplateView.php:16
‪TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext\setRequest
‪setRequest(Request $request)
Definition: ControllerContext.php:76
‪TYPO3\CMS\Fluid\View\AbstractTemplateView\setTemplateRootPaths
‪setTemplateRootPaths(array $templateRootPaths)
Definition: AbstractTemplateView.php:123