TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CycleViewHelper Class Reference
Inheritance diagram for CycleViewHelper:
AbstractViewHelper

Public Member Functions

 render ($values, $as)
 
- Public Member Functions inherited from AbstractViewHelper
 setArguments (array $arguments)
 
 setRenderingContext (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 injectReflectionService (\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService)
 
 isEscapingInterceptorEnabled ()
 
 setViewHelperNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $node)
 
 setRenderChildrenClosure (\Closure $renderChildrenClosure)
 
 initializeArgumentsAndRender ()
 
 initialize ()
 
 renderChildren ()
 
 prepareArguments ()
 
 validateArguments ()
 
 initializeArguments ()
 
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode,\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode,\TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 
 resetState ()
 

Protected Member Functions

 initializeValues ($values)
 
- 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)
 

Protected Attributes

 $values = null
 
 $currentCycleIndex = null
 
- Protected Attributes inherited from AbstractViewHelper
 $arguments
 
 $templateVariableContainer
 
 $controllerContext
 
 $renderingContext
 
 $renderChildrenClosure = null
 
 $viewHelperVariableContainer
 
 $objectManager
 
 $escapingInterceptorEnabled = true
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractViewHelper
static renderStatic (array $arguments,\Closure $renderChildrenClosure,\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 

Detailed Description

This ViewHelper cycles through the specified values. This can be often used to specify CSS classes for example. Note: To achieve the "zebra class" effect in a loop you can also use the "iteration" argument of the for ViewHelper.

= Examples =

<f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo"><f:cycle values="{0: 'foo', 1: 'bar', 2: 'baz'}" as="cycle">{cycle}</f:cycle></f:for> <output> foobarbazfoo </output>

f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo"> <f:cycle values="{0: 'odd', 1: 'even'}" as="zebraClass"> {foo} </f:cycle> </f:for> <output>

</output>

Definition at line 48 of file CycleViewHelper.php.

Member Function Documentation

initializeValues (   $values)
protected

Sets this->values to the current values argument and resets $this->currentCycleIndex.

Parameters
array | \Traversable$valuesThe array or to be stored in $this->values
Returns
void
Exceptions
\TYPO3\CMS\Fluid\Core\ViewHelper\Exception

Definition at line 99 of file CycleViewHelper.php.

References CycleViewHelper\$values.

Referenced by CycleViewHelper\render().

render (   $values,
  $as 
)
Parameters
array$valuesThe array or object implementing (for example ) to iterated over
string$asThe name of the iteration variable
Returns
string Rendered result

Definition at line 70 of file CycleViewHelper.php.

References CycleViewHelper\$currentCycleIndex, CycleViewHelper\$values, CycleViewHelper\initializeValues(), and AbstractViewHelper\renderChildren().

Member Data Documentation

$currentCycleIndex = null
protected

Definition at line 62 of file CycleViewHelper.php.

Referenced by CycleViewHelper\render().

$values = null
protected

Definition at line 55 of file CycleViewHelper.php.

Referenced by CycleViewHelper\initializeValues(), and CycleViewHelper\render().