PHP Trait FluidTYPO3\Vhs\Traits\ConditionViewHelperTrait

Datei anzeigen Open project: fluidtypo3/vhs

Public Methods

Method Description
render ( ) : string renders child if $condition is true, otherwise renders child.
renderStatic ( array $arguments, Closure $renderChildrenClosure, TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : mixed Default implementation for use in compiled templates

Protected Methods

Method Description
evaluateCondition ( array $arguments = null ) : boolean This method decides if the condition is TRUE or FALSE.
renderStaticElseChild ( array $arguments, boolean &$hasEvaluated ) : string Statically evalute "else" children.
renderStaticThenChild ( array $arguments, boolean &$hasEvaluated ) : string Statically evalute "then" children.

Method Details

evaluateCondition() protected static method

TODO: remove at some point, because this is only here for legacy reasons. the AbstractConditionViewHelper in 6.2.* doesn't have a default render method. 7.2+ on the other hand provides basically exactly this method here luckily it's backwards compatible out of the box. tl;dr -> remove after expiration of support for anything below 7.2
protected static evaluateCondition ( array $arguments = null ) : boolean
$arguments array
return boolean

render() public method

renders child if $condition is true, otherwise renders child.
public render ( ) : string
return string the rendered string

renderStatic() public static method

TODO: remove at some point, because this is only here for legacy reasons. the AbstractConditionViewHelper in 6.2.* doesn't have a default render method. 7.2+ on the other hand provides basically exactly this method here luckily it's backwards compatible out of the box. tl;dr -> remove after expiration of support for anything below 7.2
public static renderStatic ( array $arguments, Closure $renderChildrenClosure, TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : mixed
$arguments array
$renderChildrenClosure Closure
$renderingContext TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface
return mixed

renderStaticElseChild() protected static method

The "$hasEvaluated" argument is there to distinguish the case that "else" returned NULL or was not evaluated. TODO: remove at some point, because this is only here for legacy reasons. the AbstractConditionViewHelper in 6.2.* doesn't have a default render method. 7.2+ on the other hand provides basically exactly this method here luckily it's backwards compatible out of the box. tl;dr -> remove after expiration of support for anything below 7.2
protected static renderStaticElseChild ( array $arguments, boolean &$hasEvaluated ) : string
$arguments array ViewHelper arguments
$hasEvaluated boolean Can be used to check if the "else" child was actually evaluated by this method.
return string

renderStaticThenChild() protected static method

The "$hasEvaluated" argument is there to distinguish the case that "then" returned NULL or was not evaluated. TODO: remove at some point, because this is only here for legacy reasons. the AbstractConditionViewHelper in 6.2.* doesn't have a default render method. 7.2+ on the other hand provides basically exactly this method here luckily it's backwards compatible out of the box. tl;dr -> remove after expiration of support for anything below 7.2
protected static renderStaticThenChild ( array $arguments, boolean &$hasEvaluated ) : string
$arguments array ViewHelper arguments
$hasEvaluated boolean Can be used to check if the "then" child was actually evaluated by this method.
return string