TYPO3 CMS  TYPO3_8-7
TemplateView.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Fluid\View;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
26 {
30  public function initializeView()
31  {
32  }
33 
37  public function setTemplate($templateName)
38  {
39  $this->baseRenderingContext->setControllerAction($templateName);
40  }
41 
49  public function setTemplatePathAndFilename($templatePathAndFilename)
50  {
51  $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename);
52  }
53 
60  public function setLayoutPathAndFilename($layoutPathAndFilename)
61  {
62  $this->baseRenderingContext->getTemplatePaths()->setLayoutPathAndFilename($layoutPathAndFilename);
63  }
64 
70  public function getTemplateRootPaths()
71  {
72  return $this->baseRenderingContext->getTemplatePaths()->getTemplateRootPaths();
73  }
74 
82  public function setTemplateRootPaths(array $templateRootPaths)
83  {
84  $this->baseRenderingContext->getTemplatePaths()->setTemplateRootPaths($templateRootPaths);
85  }
86 
94  public function setPartialRootPaths(array $partialRootPaths)
95  {
96  $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths);
97  }
98 
106  public function setLayoutRootPaths(array $layoutRootPaths)
107  {
108  $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths);
109  }
110 
118  public function canRender(ControllerContext $controllerContext)
119  {
120  try {
121  $request = $controllerContext->getRequest();
122  $this->setControllerContext($controllerContext);
123  $this->baseRenderingContext->getTemplatePaths()->setFormat($request->getFormat());
124  $this->baseRenderingContext->getTemplatePaths()->getTemplateSource($request->getControllerName(), $request->getControllerActionName());
125  return true;
126  } catch (InvalidTemplateResourceException $e) {
127  return false;
128  }
129  }
130 }
setTemplatePathAndFilename($templatePathAndFilename)
canRender(ControllerContext $controllerContext)
setPartialRootPaths(array $partialRootPaths)
setLayoutPathAndFilename($layoutPathAndFilename)
setTemplateRootPaths(array $templateRootPaths)
setLayoutRootPaths(array $layoutRootPaths)