TYPO3 CMS  TYPO3_6-2
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 Tx_Fluid_View_TemplateView 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

 getTemplateRootPath ()
 
 getPartialRootPath ()
 
 getLayoutRootPath ()
 
 getTemplateSource ($actionName=NULL)
 
 getLayoutIdentifier ($layoutName='Default')
 
 getLayoutSource ($layoutName='Default')
 
 getLayoutPathAndFilename ($layoutName='Default')
 
 getPartialIdentifier ($partialName)
 
 getPartialSource ($partialName)
 
 getPartialPathAndFilename ($partialName)
 
 expandPatterns (array &$patterns, $search, array $replacements)
 
 resolveFileNamePath ($pathAndFilename)
 
- Protected Member Functions inherited from TYPO3\CMS\Fluid\View\AbstractTemplateView
 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 = array()
 
 $partialIdentifierCache = array()
 

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 22 of file TemplateView.php.

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ 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
boolean

Definition at line 487 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 591 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 379 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 418 of file TemplateView.php.

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

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

◆ getLayoutRootPath()

TYPO3\CMS\Fluid\View\TemplateView::getLayoutRootPath ( )
protected
Returns
string Path to layout root directory
Deprecated:
since fluid 6.2, will be removed two versions later. Use getLayoutRootPaths() instead

Definition at line 288 of file TemplateView.php.

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

◆ 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 397 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 440 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\resolveFileNamePath().

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

◆ getPartialRootPath()

TYPO3\CMS\Fluid\View\TemplateView::getPartialRootPath ( )
protected
Returns
string Path to partial root directory
Deprecated:
since fluid 6.2, will be removed two versions later. Use setPartialRootPaths() instead

Definition at line 227 of file TemplateView.php.

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

◆ 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 453 of file TemplateView.php.

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

◆ getTemplateRootPath()

TYPO3\CMS\Fluid\View\TemplateView::getTemplateRootPath ( )
protected
Returns
string Path to template root directory
Deprecated:
since fluid 6.2, will be removed two versions later. Use getTemplateRootPaths() instead

Definition at line 178 of file TemplateView.php.

References TYPO3\CMS\Fluid\View\TemplateView\$templateRootPaths, and TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ 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 334 of file TemplateView.php.

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

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

◆ initializeView()

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

Initializes this view.

Returns
void

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

Definition at line 134 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 631 of file TemplateView.php.

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

Referenced by TYPO3\CMS\Fluid\View\TemplateView\getLayoutPathAndFilename(), TYPO3\CMS\Fluid\View\TemplateView\getPartialPathAndFilename(), 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 157 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 268 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 280 of file TemplateView.php.

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

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 219 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 241 of file TemplateView.php.

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

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 146 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 170 of file TemplateView.php.

References 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 206 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 112 of file TemplateView.php.

◆ $layoutRootPathPattern

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

Definition at line 49 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 98 of file TemplateView.php.

◆ $partialRootPathPattern

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

Definition at line 40 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 84 of file TemplateView.php.

◆ $templateRootPathPattern

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

Definition at line 31 of file TemplateView.php.

◆ $templateRootPaths

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