PHP Trait FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait

Trait implementable by ViewHelpers which operate with template variables in one way or another. Contains the following main responsibilities: - A generic "as" argument solution - A method to render child content with automatically backed up variables specified in an array.
Datei anzeigen Open project: fluidtypo3/vhs

Public Methods

Method Description
initializeArguments ( ) : void Default initialisation of arguments - will be used if the implementing ViewHelper does not itself define this method. The default behavior is to only register the "as" argument.

Protected Methods

Method Description
registerAsArgument ( ) : void Registers the "as" argument for use with the implementing ViewHelper.
renderChildrenWithVariableOrReturnInput ( string $variable = null ) : mixed
renderChildrenWithVariableOrReturnInputStatic ( mixed $variable, string $as, TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext, Closure $renderChildrenClosure ) : mixed
renderChildrenWithVariables ( array $variables ) : mixed Renders tag content of ViewHelper and inserts variables in $variables into $variableContainer while keeping backups of each existing variable, restoring it after rendering.
renderChildrenWithVariablesStatic ( array $variables, TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $templateVariableContainer, Closure $renderChildrenClosure ) : mixed Renders tag content of ViewHelper and inserts variables in $variables into $variableContainer while keeping backups of each existing variable, restoring it after rendering.

Private Methods

Method Description
backupVariables ( array $variables, TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $templateVariableContainer ) : array
restoreVariables ( array $variables, array $backups, TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $templateVariableContainer ) : void

Method Details

initializeArguments() public method

Default initialisation of arguments - will be used if the implementing ViewHelper does not itself define this method. The default behavior is to only register the "as" argument.
public initializeArguments ( ) : void
return void

registerAsArgument() protected method

Registers the "as" argument for use with the implementing ViewHelper.
protected registerAsArgument ( ) : void
return void

renderChildrenWithVariableOrReturnInput() protected method

protected renderChildrenWithVariableOrReturnInput ( string $variable = null ) : mixed
$variable string
return mixed

renderChildrenWithVariableOrReturnInputStatic() protected static method

protected static renderChildrenWithVariableOrReturnInputStatic ( mixed $variable, string $as, TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext, Closure $renderChildrenClosure ) : mixed
$variable mixed
$as string
$renderingContext TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface
$renderChildrenClosure Closure
return mixed

renderChildrenWithVariables() protected method

Returns the output of the renderChildren() method on $viewHelper.
protected renderChildrenWithVariables ( array $variables ) : mixed
$variables array
return mixed

renderChildrenWithVariablesStatic() protected static method

Returns the output of the renderChildren() method on $viewHelper.
protected static renderChildrenWithVariablesStatic ( array $variables, TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer $templateVariableContainer, Closure $renderChildrenClosure ) : mixed
$variables array
$templateVariableContainer TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer
$renderChildrenClosure Closure
return mixed