TYPO3
7.6
|
Static Public Member Functions | |
static | renderStatic (array $arguments,\Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
Static Public Member Functions inherited from AbstractViewHelper | |
static | renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext) |
Static Public Member Functions inherited from CompilableInterface | |
static | renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext) |
Protected Attributes | |
$backupSwitchExpression = null | |
$backupBreakState = false | |
Protected Attributes inherited from AbstractViewHelper | |
$arguments | |
$templateVariableContainer | |
$controllerContext | |
$renderingContext | |
$renderChildrenClosure = null | |
$viewHelperVariableContainer | |
$objectManager | |
$escapingInterceptorEnabled = true | |
Private Attributes | |
$childNodes = array() | |
Additional Inherited Members | |
Protected Member Functions inherited from AbstractViewHelper | |
registerArgument ($name, $type, $description, $required=false, $defaultValue=null) | |
overrideArgument ($name, $type, $description, $required=false, $defaultValue=null) | |
callRenderMethod () | |
getLogger () | |
buildRenderChildrenClosure () | |
hasArgument ($argumentName) | |
Switch view helper which can be used to render content depending on a value or expression. Implements what a basic switch()-PHP-method does.
= Examples =
<f:switch expression="{person.gender}"> <f:case value="male">Mr.</f:case> <f:case value="female">Mrs.</f:case> <f:case default="TRUE">Mrs. or Mr.</f:case> </f:switch>
<output> Mr. / Mrs. (depending on the value of {person.gender}) or if no value evaluates to TRUE, default case </output>
Note: Using this view helper can be a sign of weak architecture. If you end up using it extensively you might want to consider restructuring your controllers/actions and/or use partials and sections. E.g. the above example could be achieved with <f:render partial="title.{person.gender}" /> and the partials "title.male.html", "title.female.html", ... Depending on the scenario this can be easier to extend and possibly contains less duplication.
Definition at line 44 of file SwitchViewHelper.php.
render | ( | $expression | ) |
mixed | $expression |
Definition at line 78 of file SwitchViewHelper.php.
References AbstractViewHelper\buildRenderChildrenClosure().
|
static |
Default implementation for CompilableInterface. See CompilableInterface for a detailed description of this method.
array | $arguments | |
\Closure | $renderChildrenClosure | |
RenderingContextInterface | $renderingContext |
Definition at line 99 of file SwitchViewHelper.php.
References AbstractViewHelper\$renderChildrenClosure, AbstractViewHelper\$viewHelperVariableContainer, and RenderingContextInterface\getViewHelperVariableContainer().
setChildNodes | ( | array | $childNodes | ) |
Setter for ChildNodes - as defined in ChildNodeAccessInterface
array | $childNodes | Child nodes of this syntax tree node |
Implements ChildNodeAccessInterface.
Definition at line 68 of file SwitchViewHelper.php.
References SwitchViewHelper\$childNodes.
|
protected |
Definition at line 60 of file SwitchViewHelper.php.
|
protected |
Definition at line 55 of file SwitchViewHelper.php.
|
private |
Definition at line 50 of file SwitchViewHelper.php.
Referenced by SwitchViewHelper\setChildNodes().