TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Fluid\View\TemplateView Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\View\TemplateView:
TYPO3\CMS\Fluid\View\AbstractTemplateView TYPO3\CMS\Extbase\Mvc\View\ViewInterface TYPO3\CMS\Fluid\Tests\Unit\View\Fixtures\TemplateViewFixture

Public Member Functions

 __construct ()
 
 initializeView ()
 
 setTemplatePathAndFilename ($templatePathAndFilename)
 
 setLayoutPathAndFilename ($layoutPathAndFilename)
 
 setTemplateRootPath ($templateRootPath)
 
 setTemplateRootPaths (array $templateRootPaths)
 
 setPartialRootPath ($partialRootPath)
 
 setPartialRootPaths (array $partialRootPaths)
 
 setLayoutRootPath ($layoutRootPath)
 
 setLayoutRootPaths (array $layoutRootPaths)
 
 canRender (ControllerContext $controllerContext)
 
- Public Member Functions inherited from TYPO3\CMS\Fluid\View\AbstractTemplateView
 injectTemplateCompiler (\TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 
 setRenderingContext (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 setControllerContext (\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext)
 
 initializeView ()
 
 assign ($key, $value)
 
 assignMultiple (array $values)
 
 render ($actionName=null)
 
 renderSection ($sectionName, array $variables, $ignoreUnknown=false)
 
 renderPartial ($partialName, $sectionName, array $variables)
 
 canRender (\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext)
 
- Public Member Functions inherited from TYPO3\CMS\Extbase\Mvc\View\ViewInterface
 setControllerContext (\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext)
 
 canRender (\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext)
 
 render ()
 

Protected Member Functions

 getTemplateSource ($actionName=null)
 
 getLayoutIdentifier ($layoutName='Default')
 
 getLayoutSource ($layoutName='Default')
 
 getLayoutPathAndFilename ($layoutName='Default')
 
 getPartialIdentifier ($partialName)
 
 getPartialSource ($partialName)
 
 getPartialPathAndFilename ($partialName)
 
 buildListOfTemplateCandidates ($templateName, $paths, $marker)
 
 expandPatterns (array &$patterns, $search, array $replacements)
 
 resolveFileNamePath ($pathAndFilename)
 
- Protected Member Functions inherited from TYPO3\CMS\Fluid\View\AbstractTemplateView
 ucFileNameInPath ($templatePath)
 
 testFileExistence ($filePath)
 
 getTemplateIdentifier ($actionName=null)
 
 getTemplateSource ($actionName=null)
 
 getLayoutIdentifier ($layoutName='Default')
 
 getLayoutSource ($layoutName='Default')
 
 getPartialIdentifier ($partialName)
 
 getPartialSource ($partialName)
 
 buildParserConfiguration ()
 
 startRendering ($type, \TYPO3\CMS\Fluid\Core\Parser\ParsedTemplateInterface $parsedTemplate, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 stopRendering ()
 
 getCurrentRenderingType ()
 
 getCurrentParsedTemplate ()
 
 getCurrentRenderingContext ()
 

Protected Attributes

 $templateRootPathPattern = '@packageResourcesPath/Private/Templates'
 
 $partialRootPathPattern = '@packageResourcesPath/Private/Partials'
 
 $layoutRootPathPattern = '@packageResourcesPath/Private/Layouts'
 
 $templateRootPaths = null
 
 $partialRootPaths = null
 
 $layoutRootPaths = null
 
 $templatePathAndFilenamePattern = '@templateRoot/@subpackage/@controller/@action.@format'
 
 $layoutPathAndFilenamePattern = '@layoutRoot/@layout.@format'
 
 $templatePathAndFilename = null
 
 $layoutPathAndFilename = null
 
- Protected Attributes inherited from TYPO3\CMS\Fluid\View\AbstractTemplateView
 $controllerContext
 
 $objectManager
 
 $templateParser
 
 $templateCompiler
 
 $baseRenderingContext
 
 $renderingStack = []
 
 $partialIdentifierCache = []
 

Private Attributes

 $partialPathAndFilenamePattern = '@partialRoot/@subpackage/@partial.@format'
 

Additional Inherited Members

- Public Attributes inherited from TYPO3\CMS\Fluid\View\AbstractTemplateView
const RENDERING_TEMPLATE = 1
 
const RENDERING_PARTIAL = 2
 
const RENDERING_LAYOUT = 3
 

Detailed Description

The main template view. Should be used as view if you want Fluid Templating

Definition at line 27 of file TemplateView.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Fluid\View\TemplateView::__construct ( )

Member Function Documentation

◆ buildListOfTemplateCandidates()

TYPO3\CMS\Fluid\View\TemplateView::buildListOfTemplateCandidates (   $templateName,
  $paths,
  $marker 
)
protected

Builds a list of possible candidates for a given template name

Parameters
string$templateName
array$pathsPaths to search in
string$markerMarker to replace in the $templateName
Returns
array Array of paths to search for the template file

Definition at line 489 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\resolveFileNamePath(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\ucFileNameInPath().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\getLayoutPathAndFilename(), TYPO3\CMS\Fluid\View\TemplateView\getPartialPathAndFilename(), and TYPO3\CMS\Fluid\View\TemplateView\getTemplateSource().

◆ canRender()

TYPO3\CMS\Fluid\View\TemplateView::canRender ( ControllerContext  $controllerContext)

Checks whether a template can be resolved for the current request context.

Parameters
ControllerContext$controllerContextController context which is available inside the view
Returns
bool

Definition at line 509 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\expandPatterns(), TYPO3\CMS\Fluid\View\TemplateView\getTemplateSource(), TYPO3\CMS\Fluid\Fluid\LEGACY_NAMESPACE_SEPARATOR, TYPO3\CMS\Fluid\Fluid\NAMESPACE_SEPARATOR, and TYPO3\CMS\Fluid\View\AbstractTemplateView\setControllerContext().

◆ expandPatterns()

TYPO3\CMS\Fluid\View\TemplateView::expandPatterns ( array &  $patterns,
  $search,
array  $replacements 
)
protected

Expands the given $patterns by adding an array element for each $replacement replacing occurrences of $search.

Parameters
array$patterns
string$search
array$replacements
Returns
void

Definition at line 615 of file TemplateView.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\fixWindowsFilePath().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\canRender().

◆ getLayoutIdentifier()

TYPO3\CMS\Fluid\View\TemplateView::getLayoutIdentifier (   $layoutName = 'Default')
protected

Returns a unique identifier for the resolved layout file. This identifier is based on the template path and last modification date

Parameters
string$layoutNameThe name of the layout
Returns
string layout identifier

Definition at line 375 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$layoutPathAndFilename, and TYPO3\CMS\Fluid\View\TemplateView\getLayoutPathAndFilename().

◆ getLayoutPathAndFilename()

TYPO3\CMS\Fluid\View\TemplateView::getLayoutPathAndFilename (   $layoutName = 'Default')
protected

Resolve the path and file name of the layout file, based on $this->layoutPathAndFilename and $this->layoutPathAndFilenamePattern.

In case a layout has already been set with setLayoutPathAndFilename(), this method returns that path, otherwise a path and filename will be resolved using the layoutPathAndFilenamePattern.

Parameters
string$layoutNameName of the layout to use. If none given, use "Default"
Returns
string Path and filename of layout files
Exceptions
Exception

Definition at line 416 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$layoutPathAndFilename, TYPO3\CMS\Fluid\View\TemplateView\buildListOfTemplateCandidates(), TYPO3\CMS\Fluid\View\TemplateView\resolveFileNamePath(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\getLayoutIdentifier(), and TYPO3\CMS\Fluid\View\TemplateView\getLayoutSource().

◆ getLayoutSource()

TYPO3\CMS\Fluid\View\TemplateView::getLayoutSource (   $layoutName = 'Default')
protected

Resolve the path and file name of the layout file, based on $this->layoutPathAndFilename and $this->layoutPathAndFilenamePattern.

In case a layout has already been set with setLayoutPathAndFilename(), this method returns that path, otherwise a path and filename will be resolved using the layoutPathAndFilenamePattern.

Parameters
string$layoutNameName of the layout to use. If none given, use "Default"
Returns
string contents of the layout template
Exceptions
Exception

Definition at line 394 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$layoutPathAndFilename, and TYPO3\CMS\Fluid\View\TemplateView\getLayoutPathAndFilename().

◆ getPartialIdentifier()

TYPO3\CMS\Fluid\View\TemplateView::getPartialIdentifier (   $partialName)
protected

Returns a unique identifier for the resolved partial file. This identifier is based on the template path and last modification date

Parameters
string$partialNameThe name of the partial
Returns
string partial identifier

Definition at line 438 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\getPartialPathAndFilename().

◆ getPartialPathAndFilename()

TYPO3\CMS\Fluid\View\TemplateView::getPartialPathAndFilename (   $partialName)
protected

Resolve the partial path and filename based on $this->partialPathAndFilenamePattern.

Parameters
string$partialNameThe name of the partial
Returns
string the full path which should be used. The path definitely exists.
Exceptions
Exception

Definition at line 469 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\buildListOfTemplateCandidates(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\getPartialIdentifier(), and TYPO3\CMS\Fluid\View\TemplateView\getPartialSource().

◆ getPartialSource()

TYPO3\CMS\Fluid\View\TemplateView::getPartialSource (   $partialName)
protected

Figures out which partial to use.

Parameters
string$partialNameThe name of the partial
Returns
string contents of the partial template
Exceptions
Exception

Definition at line 452 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\getPartialPathAndFilename().

◆ getTemplateSource()

TYPO3\CMS\Fluid\View\TemplateView::getTemplateSource (   $actionName = null)
protected

Resolve the template path and filename for the given action. If $actionName is NULL, looks into the current request.

Parameters
string$actionNameName of the action. If NULL, will be taken from request.
Returns
string Full path to template
Exceptions
Exception

Definition at line 329 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$templatePathAndFilename, TYPO3\CMS\Fluid\View\TemplateView\buildListOfTemplateCandidates(), TYPO3\CMS\Fluid\View\TemplateView\resolveFileNamePath(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\canRender().

◆ initializeView()

TYPO3\CMS\Fluid\View\TemplateView::initializeView ( )

Init view

Implements TYPO3\CMS\Extbase\Mvc\View\ViewInterface.

Definition at line 146 of file TemplateView.php.

◆ resolveFileNamePath()

TYPO3\CMS\Fluid\View\TemplateView::resolveFileNamePath (   $pathAndFilename)
protected

Wrapper method to make the static call to GeneralUtility mockable in tests

Parameters
string$pathAndFilename
Returns
string absolute pathAndFilename

Definition at line 657 of file TemplateView.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\fixWindowsFilePath(), and TYPO3\CMS\Core\Utility\GeneralUtility\getFileAbsFileName().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\buildListOfTemplateCandidates(), TYPO3\CMS\Fluid\View\TemplateView\getLayoutPathAndFilename(), and TYPO3\CMS\Fluid\View\TemplateView\getTemplateSource().

◆ setLayoutPathAndFilename()

TYPO3\CMS\Fluid\View\TemplateView::setLayoutPathAndFilename (   $layoutPathAndFilename)

Sets the path and name of the layout file. Overrides the dynamic resolving of the layout file.

Parameters
string$layoutPathAndFilenamePath and filename of the layout file
Returns
void

Definition at line 171 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$layoutPathAndFilename.

◆ setLayoutRootPath()

TYPO3\CMS\Fluid\View\TemplateView::setLayoutRootPath (   $layoutRootPath)

Set the root path to the layouts. If set, overrides the one determined from $this->layoutRootPathPattern

Parameters
string$layoutRootPathRoot path to the layouts. If set, overrides the one determined from $this->layoutRootPathPattern
Returns
void
See also
setLayoutRootPaths()

Definition at line 269 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\setLayoutRootPaths().

◆ setLayoutRootPaths()

TYPO3\CMS\Fluid\View\TemplateView::setLayoutRootPaths ( array  $layoutRootPaths)

Set the root path(s) to the layouts. If set, overrides the one determined from $this->layoutRootPathPattern

Parameters
array$layoutRootPathsRoot path to the layouts. If set, overrides the one determined from $this->layoutRootPathPattern
Returns
void

Definition at line 282 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$layoutRootPaths, TYPO3\CMS\Fluid\View\TemplateView\$templatePathAndFilename, TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\getTemplateIdentifier().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\setLayoutRootPath().

◆ setPartialRootPath()

TYPO3\CMS\Fluid\View\TemplateView::setPartialRootPath (   $partialRootPath)

Set the root path to the partials. If set, overrides the one determined from $this->partialRootPathPattern

Parameters
string$partialRootPathRoot path to the partials. If set, overrides the one determined from $this->partialRootPathPattern
Returns
void
See also
setPartialRootPaths()

Definition at line 227 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\setPartialRootPaths().

◆ setPartialRootPaths()

TYPO3\CMS\Fluid\View\TemplateView::setPartialRootPaths ( array  $partialRootPaths)

Set the root path(s) to the partials. If set, overrides the one determined from $this->partialRootPathPattern

Parameters
array$partialRootPathsRoot paths to the partials. If set, overrides the one determined from $this->partialRootPathPattern
Returns
void

Definition at line 240 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$partialRootPaths, and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath().

Referenced by TYPO3\CMS\Fluid\View\TemplateView\setPartialRootPath().

◆ setTemplatePathAndFilename()

TYPO3\CMS\Fluid\View\TemplateView::setTemplatePathAndFilename (   $templatePathAndFilename)

Sets the path and name of of the template file. Effectively overrides the dynamic resolving of a template file.

Parameters
string$templatePathAndFilenameTemplate file path
Returns
void

Definition at line 159 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$templatePathAndFilename.

◆ setTemplateRootPath()

TYPO3\CMS\Fluid\View\TemplateView::setTemplateRootPath (   $templateRootPath)

Set the root path to the templates. If set, overrides the one determined from $this->templateRootPathPattern

Parameters
string$templateRootPathRoot path to the templates. If set, overrides the one determined from $this->templateRootPathPattern
Returns
void
See also
setTemplateRootPaths()

Definition at line 185 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$templateRootPaths, TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), and TYPO3\CMS\Fluid\View\TemplateView\setTemplateRootPaths().

◆ setTemplateRootPaths()

TYPO3\CMS\Fluid\View\TemplateView::setTemplateRootPaths ( array  $templateRootPaths)

Set the root path(s) to the templates. If set, overrides the one determined from $this->templateRootPathPattern

Parameters
array$templateRootPathsRoot path(s) to the templates. If set, overrides the one determined from $this->templateRootPathPattern
Returns
void

Definition at line 213 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$templateRootPaths.

Referenced by TYPO3\CMS\Fluid\View\TemplateView\setTemplateRootPath().

Member Data Documentation

◆ $layoutPathAndFilename

◆ $layoutPathAndFilenamePattern

TYPO3\CMS\Fluid\View\TemplateView::$layoutPathAndFilenamePattern = '@layoutRoot/@layout.@format'
protected

Definition at line 117 of file TemplateView.php.

◆ $layoutRootPathPattern

TYPO3\CMS\Fluid\View\TemplateView::$layoutRootPathPattern = '@packageResourcesPath/Private/Layouts'
protected

Definition at line 54 of file TemplateView.php.

◆ $layoutRootPaths

TYPO3\CMS\Fluid\View\TemplateView::$layoutRootPaths = null
protected

◆ $partialPathAndFilenamePattern

TYPO3\CMS\Fluid\View\TemplateView::$partialPathAndFilenamePattern = '@partialRoot/@subpackage/@partial.@format'
private

Definition at line 103 of file TemplateView.php.

◆ $partialRootPathPattern

TYPO3\CMS\Fluid\View\TemplateView::$partialRootPathPattern = '@packageResourcesPath/Private/Partials'
protected

Definition at line 45 of file TemplateView.php.

◆ $partialRootPaths

TYPO3\CMS\Fluid\View\TemplateView::$partialRootPaths = null
protected

◆ $templatePathAndFilename

TYPO3\CMS\Fluid\View\TemplateView::$templatePathAndFilename = null
protected

◆ $templatePathAndFilenamePattern

TYPO3\CMS\Fluid\View\TemplateView::$templatePathAndFilenamePattern = '@templateRoot/@subpackage/@controller/@action.@format'
protected

Definition at line 89 of file TemplateView.php.

◆ $templateRootPathPattern

TYPO3\CMS\Fluid\View\TemplateView::$templateRootPathPattern = '@packageResourcesPath/Private/Templates'
protected

Definition at line 36 of file TemplateView.php.

◆ $templateRootPaths

TYPO3\CMS\Fluid\View\TemplateView::$templateRootPaths = null
protected