TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
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 
18 use TYPO3\CMS\Fluid\Fluid;
19 use TYPO3Fluid\Fluid\View\Exception\InvalidTemplateResourceException;
20 
27 {
31  public function initializeView()
32  {
33  }
34 
38  public function setTemplate($templateName)
39  {
40  $this->baseRenderingContext->setControllerAction($templateName);
41  }
42 
51  public function setTemplatePathAndFilename($templatePathAndFilename)
52  {
53  $this->baseRenderingContext->getTemplatePaths()->setTemplatePathAndFilename($templatePathAndFilename);
54  }
55 
63  public function setLayoutPathAndFilename($layoutPathAndFilename)
64  {
65  $this->baseRenderingContext->getTemplatePaths()->setLayoutPathAndFilename($layoutPathAndFilename);
66  }
67 
73  public function getTemplateRootPaths()
74  {
75  return $this->baseRenderingContext->getTemplatePaths()->getTemplateRootPaths();
76  }
77 
86  public function setTemplateRootPaths(array $templateRootPaths)
87  {
88  $this->baseRenderingContext->getTemplatePaths()->setTemplateRootPaths($templateRootPaths);
89  }
90 
99  public function setPartialRootPaths(array $partialRootPaths)
100  {
101  $this->baseRenderingContext->getTemplatePaths()->setPartialRootPaths($partialRootPaths);
102  }
103 
112  public function setLayoutRootPaths(array $layoutRootPaths)
113  {
114  $this->baseRenderingContext->getTemplatePaths()->setLayoutRootPaths($layoutRootPaths);
115  }
116 
124  public function canRender(ControllerContext $controllerContext)
125  {
126  try {
127  $request = $controllerContext->getRequest();
128  $this->setControllerContext($controllerContext);
129  $this->baseRenderingContext->getTemplatePaths()->setFormat($request->getFormat());
130  $this->baseRenderingContext->getTemplatePaths()->getTemplateSource($request->getControllerName(), $request->getControllerActionName());
131  return true;
132  } catch (InvalidTemplateResourceException $e) {
133  return false;
134  }
135  }
136 }
setTemplateRootPaths(array $templateRootPaths)
setPartialRootPaths(array $partialRootPaths)
canRender(ControllerContext $controllerContext)
setLayoutPathAndFilename($layoutPathAndFilename)
setTemplatePathAndFilename($templatePathAndFilename)
setLayoutRootPaths(array $layoutRootPaths)