TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
TemplateView Class Reference
Inheritance diagram for TemplateView:
AbstractTemplateView ViewInterface 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 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 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 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 AbstractTemplateView
 $controllerContext
 
 $objectManager
 
 $templateParser
 
 $templateCompiler
 
 $baseRenderingContext
 
 $renderingStack = array()
 
 $partialIdentifierCache = array()
 

Private Attributes

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

Additional Inherited Members

- Public Attributes inherited from 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 ( )

Constructor

Definition at line 136 of file TemplateView.php.

References GeneralUtility\makeInstance(), and AbstractTemplateView\setRenderingContext().

Member Function Documentation

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 TemplateView\resolveFileNamePath(), and AbstractTemplateView\ucFileNameInPath().

Referenced by TemplateView\getLayoutPathAndFilename(), and TemplateView\getPartialPathAndFilename().

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 TemplateView\getTemplateSource(), and AbstractTemplateView\setControllerContext().

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 GeneralUtility\fixWindowsFilePath().

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 TemplateView\$layoutPathAndFilename, and TemplateView\getLayoutPathAndFilename().

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\InvalidTemplateResourceException

Definition at line 416 of file TemplateView.php.

References TemplateView\$layoutPathAndFilename, TemplateView\buildListOfTemplateCandidates(), TemplateView\resolveFileNamePath(), and AbstractTemplateView\testFileExistence().

Referenced by TemplateView\getLayoutIdentifier(), and TemplateView\getLayoutSource().

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\InvalidTemplateResourceException

Definition at line 394 of file TemplateView.php.

References TemplateView\$layoutPathAndFilename, and TemplateView\getLayoutPathAndFilename().

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 TemplateView\getPartialPathAndFilename().

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\InvalidTemplateResourceException

Definition at line 469 of file TemplateView.php.

References TemplateView\buildListOfTemplateCandidates(), and AbstractTemplateView\testFileExistence().

Referenced by TemplateView\getPartialIdentifier(), and TemplateView\getPartialSource().

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\InvalidTemplateResourceException

Definition at line 452 of file TemplateView.php.

References TemplateView\getPartialPathAndFilename().

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\InvalidTemplateResourceException

Definition at line 329 of file TemplateView.php.

References TemplateView\$templatePathAndFilename.

Referenced by TemplateView\canRender().

initializeView ( )

Init view

Implements ViewInterface.

Definition at line 146 of file TemplateView.php.

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 GeneralUtility\fixWindowsFilePath(), and GeneralUtility\getFileAbsFileName().

Referenced by TemplateView\buildListOfTemplateCandidates(), and TemplateView\getLayoutPathAndFilename().

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 TemplateView\$layoutPathAndFilename.

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 TemplateView\setLayoutRootPaths().

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 TemplateView\$layoutRootPaths.

Referenced by TemplateView\setLayoutRootPath().

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 TemplateView\setPartialRootPaths().

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 TemplateView\$partialRootPaths.

Referenced by TemplateView\setPartialRootPath().

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 TemplateView\$templatePathAndFilename.

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 TemplateView\setTemplateRootPaths().

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 TemplateView\$templateRootPaths.

Referenced by TemplateView\setTemplateRootPath().

Member Data Documentation

$layoutPathAndFilename = null
protected
$layoutPathAndFilenamePattern = '@layoutRoot/@layout.@format'
protected

Definition at line 117 of file TemplateView.php.

$layoutRootPathPattern = '@packageResourcesPath/Private/Layouts'
protected

Definition at line 54 of file TemplateView.php.

$layoutRootPaths = null
protected

Definition at line 75 of file TemplateView.php.

Referenced by TemplateView\setLayoutRootPaths().

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

Definition at line 103 of file TemplateView.php.

$partialRootPathPattern = '@packageResourcesPath/Private/Partials'
protected

Definition at line 45 of file TemplateView.php.

$partialRootPaths = null
protected

Definition at line 68 of file TemplateView.php.

Referenced by TemplateView\setPartialRootPaths().

$templatePathAndFilename = null
protected
$templatePathAndFilenamePattern = '@templateRoot/@subpackage/@controller/@action.@format'
protected

Definition at line 89 of file TemplateView.php.

$templateRootPathPattern = '@packageResourcesPath/Private/Templates'
protected

Definition at line 36 of file TemplateView.php.

$templateRootPaths = null
protected

Definition at line 61 of file TemplateView.php.

Referenced by TemplateView\setTemplateRootPaths().