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

Public Member Functions

 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 ()
 

Public Attributes

const RENDERING_TEMPLATE = 1
 
const RENDERING_PARTIAL = 2
 
const RENDERING_LAYOUT = 3
 

Protected Member Functions

 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

 $controllerContext
 
 $objectManager
 
 $templateParser
 
 $templateCompiler
 
 $baseRenderingContext
 
 $renderingStack = []
 
 $partialIdentifierCache = []
 

Detailed Description

Abstract Fluid Template View.

Contains the fundamental methods which any Fluid based template view needs.

Definition at line 19 of file AbstractTemplateView.php.

Member Function Documentation

◆ assign()

TYPO3\CMS\Fluid\View\AbstractTemplateView::assign (   $key,
  $value 
)

Assign a value to the variable container.

Parameters
string$keyThe key of a view variable to set
mixed$valueThe value of the view variable
Returns
the instance of this view to allow chaining

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

Definition at line 124 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Backend\LoginProvider\UsernamePasswordLoginProvider\render().

◆ assignMultiple()

TYPO3\CMS\Fluid\View\AbstractTemplateView::assignMultiple ( array  $values)

Assigns multiple values to the JSON output. However, only the key "value" is accepted.

Parameters
array$valuesKeys and values - only a value with key "value" is considered
Returns
the instance of this view to allow chaining

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

Definition at line 142 of file AbstractTemplateView.php.

◆ buildParserConfiguration()

TYPO3\CMS\Fluid\View\AbstractTemplateView::buildParserConfiguration ( )
protected

Build parser configuration

Returns

Definition at line 391 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\render().

◆ canRender()

TYPO3\CMS\Fluid\View\AbstractTemplateView::canRender ( \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext  $controllerContext)

Tells if the view implementation can render the view for the given context.

By default we assume that the view implementation can handle all kinds of contexts. Override this method if that is not the case.

Parameters
\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext$controllerContextController context which is available inside the view
Returns
bool TRUE if the view has something useful to display, otherwise FALSE

Definition at line 467 of file AbstractTemplateView.php.

◆ getCurrentParsedTemplate()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getCurrentParsedTemplate ( )
protected

Get the parsed template which is currently being rendered.

Returns

Definition at line 440 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\renderSection().

◆ getCurrentRenderingContext()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getCurrentRenderingContext ( )
protected

Get the rendering context which is currently used.

Returns

Definition at line 451 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\renderPartial(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\renderSection().

◆ getCurrentRenderingType()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getCurrentRenderingType ( )
protected

Get the current rendering type.

Returns
int one of RENDERING_* constants

Definition at line 429 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\renderSection().

◆ getLayoutIdentifier()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getLayoutIdentifier (   $layoutName = 'Default')
abstractprotected

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

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\render(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

◆ getLayoutSource()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getLayoutSource (   $layoutName = 'Default')
abstractprotected

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 file
Exceptions

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\render(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

◆ getPartialIdentifier()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getPartialIdentifier (   $partialName)
abstractprotected

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

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\renderPartial(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

◆ getPartialSource()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getPartialSource (   $partialName)
abstractprotected

Figures out which partial to use.

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

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\renderPartial(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

◆ getTemplateIdentifier()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getTemplateIdentifier (   $actionName = null)
abstractprotected

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

Parameters
string$actionNameName of the action. If NULL, will be taken from request.
Returns
string template identifier

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\render(), TYPO3\CMS\Fluid\View\TemplateView\setLayoutRootPaths(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

◆ getTemplateSource()

TYPO3\CMS\Fluid\View\AbstractTemplateView::getTemplateSource (   $actionName = null)
abstractprotected

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

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\render(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\testFileExistence().

◆ initializeView()

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

Initializes this view.

Returns
void

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

Definition at line 111 of file AbstractTemplateView.php.

◆ injectTemplateCompiler()

TYPO3\CMS\Fluid\View\AbstractTemplateView::injectTemplateCompiler ( \TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler  $templateCompiler)
Parameters
\TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler$templateCompiler
Returns
void

Definition at line 80 of file AbstractTemplateView.php.

References TYPO3\CMS\Fluid\View\AbstractTemplateView\$templateCompiler, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ render()

TYPO3\CMS\Fluid\View\AbstractTemplateView::render (   $actionName = null)

Loads the template source and render the template. If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout.

Parameters
string$actionNameIf set, the view of the specified action will be rendered instead. Default is the action specified in the Request object
Returns
string Rendered Template

Definition at line 162 of file AbstractTemplateView.php.

References TYPO3\CMS\Fluid\View\AbstractTemplateView\buildParserConfiguration(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getLayoutIdentifier(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getLayoutSource(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getTemplateIdentifier(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getTemplateSource(), TYPO3\CMS\Fluid\View\AbstractTemplateView\startRendering(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\stopRendering().

◆ renderPartial()

TYPO3\CMS\Fluid\View\AbstractTemplateView::renderPartial (   $partialName,
  $sectionName,
array  $variables 
)

Renders a partial.

Parameters
string$partialName
string$sectionName
array$variables
\TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer$viewHelperVariableContainerthe View Helper Variable container to use.
Returns
string

Definition at line 263 of file AbstractTemplateView.php.

References TYPO3\CMS\Fluid\View\AbstractTemplateView\getCurrentRenderingContext(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getPartialIdentifier(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getPartialSource(), TYPO3\CMS\Fluid\View\AbstractTemplateView\renderSection(), TYPO3\CMS\Fluid\View\AbstractTemplateView\startRendering(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\stopRendering().

◆ renderSection()

TYPO3\CMS\Fluid\View\AbstractTemplateView::renderSection (   $sectionName,
array  $variables,
  $ignoreUnknown = false 
)

Renders a given section.

Parameters
string$sectionNameName of section to render
array$variablesThe variables to use
bool$ignoreUnknownIgnore an unknown section and just return an empty string
Returns
string rendered template for the section
Exceptions

Definition at line 209 of file AbstractTemplateView.php.

References TYPO3\CMS\Fluid\View\AbstractTemplateView\getCurrentParsedTemplate(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getCurrentRenderingContext(), TYPO3\CMS\Fluid\View\AbstractTemplateView\getCurrentRenderingType(), TYPO3\CMS\Fluid\View\AbstractTemplateView\startRendering(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\stopRendering().

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\renderPartial().

◆ setControllerContext()

TYPO3\CMS\Fluid\View\AbstractTemplateView::setControllerContext ( \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext  $controllerContext)

Sets the current controller context

Parameters
\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext$controllerContextController context which is available inside the view
Returns
void

Definition at line 106 of file AbstractTemplateView.php.

References TYPO3\CMS\Fluid\View\AbstractTemplateView\$controllerContext.

Referenced by TYPO3\CMS\Install\View\StandaloneView\__construct(), and TYPO3\CMS\Fluid\View\TemplateView\canRender().

◆ setRenderingContext()

TYPO3\CMS\Fluid\View\AbstractTemplateView::setRenderingContext ( \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface  $renderingContext)

Injects a fresh rendering context

Parameters
\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface$renderingContext
Returns
void

Definition at line 92 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Install\View\StandaloneView\__construct(), and TYPO3\CMS\Fluid\View\TemplateView\__construct().

◆ startRendering()

TYPO3\CMS\Fluid\View\AbstractTemplateView::startRendering (   $type,
\TYPO3\CMS\Fluid\Core\Parser\ParsedTemplateInterface  $parsedTemplate,
\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface  $renderingContext 
)
protected

Start a new nested rendering. Pushes the given information onto the $renderingStack.

Parameters
int$typeone of the RENDERING_* constants
\TYPO3\CMS\Fluid\Core\Parser\ParsedTemplateInterface$parsedTemplate
\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface$renderingContext
Returns
void

Definition at line 408 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\render(), TYPO3\CMS\Fluid\View\AbstractTemplateView\renderPartial(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\renderSection().

◆ stopRendering()

TYPO3\CMS\Fluid\View\AbstractTemplateView::stopRendering ( )
protected

Stops the current rendering. Removes one element from the $renderingStack. Make sure to always call this method pair-wise with startRendering().

Returns
void

Definition at line 419 of file AbstractTemplateView.php.

Referenced by TYPO3\CMS\Fluid\View\AbstractTemplateView\render(), TYPO3\CMS\Fluid\View\AbstractTemplateView\renderPartial(), and TYPO3\CMS\Fluid\View\AbstractTemplateView\renderSection().

◆ testFileExistence()

◆ ucFileNameInPath()

TYPO3\CMS\Fluid\View\AbstractTemplateView::ucFileNameInPath (   $templatePath)
protected

Ensures the given templatePath gets the file name in UpperCamelCase

Parameters
string$templatePathA file name or a relative path
Returns
string

Definition at line 301 of file AbstractTemplateView.php.

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

Member Data Documentation

◆ $baseRenderingContext

TYPO3\CMS\Fluid\View\AbstractTemplateView::$baseRenderingContext
protected

Definition at line 57 of file AbstractTemplateView.php.

◆ $controllerContext

TYPO3\CMS\Fluid\View\AbstractTemplateView::$controllerContext
protected

◆ $objectManager

TYPO3\CMS\Fluid\View\AbstractTemplateView::$objectManager
protected

Definition at line 37 of file AbstractTemplateView.php.

◆ $partialIdentifierCache

TYPO3\CMS\Fluid\View\AbstractTemplateView::$partialIdentifierCache = []
protected

Definition at line 74 of file AbstractTemplateView.php.

◆ $renderingStack

TYPO3\CMS\Fluid\View\AbstractTemplateView::$renderingStack = []
protected

Definition at line 65 of file AbstractTemplateView.php.

◆ $templateCompiler

TYPO3\CMS\Fluid\View\AbstractTemplateView::$templateCompiler
protected

◆ $templateParser

TYPO3\CMS\Fluid\View\AbstractTemplateView::$templateParser
protected

Definition at line 43 of file AbstractTemplateView.php.

◆ RENDERING_LAYOUT

const TYPO3\CMS\Fluid\View\AbstractTemplateView::RENDERING_LAYOUT = 3

Definition at line 26 of file AbstractTemplateView.php.

◆ RENDERING_PARTIAL

const TYPO3\CMS\Fluid\View\AbstractTemplateView::RENDERING_PARTIAL = 2

Definition at line 25 of file AbstractTemplateView.php.

◆ RENDERING_TEMPLATE

const TYPO3\CMS\Fluid\View\AbstractTemplateView::RENDERING_TEMPLATE = 1

Constants defining possible rendering types

Definition at line 24 of file AbstractTemplateView.php.