PHP Class FluidTYPO3\Vhs\ViewHelpers\Iterator\ColumnViewHelper

Implementation of array_column for Fluid. Accepts an input iterator/array and creates a new array using values from one column and optionally keys from another column. #### Usage examples xml User {username} has UID {uid}. The above demonstrates the logic of the ViewHelper, but the example itself of course gives the same result as just iterating the users variable itself and outputting {user.username} etc., but the real power of the ViewHelper comes when using it to feed other ViewHelpers with data sets: xml Select user: xml All UIDs: {users -> v:iterator.column(columnKey: 'uid') -> v:iterator.implode()} xml Our users live in the following countries: {users -> v:iterator.column(columnKey: 'countryName') -> v:iterator.unique() -> v:iterator.implode(glue: ' - ')} Note that the ViewHelper also supports the "as" argument which allows you to not return the new array but instead assign it as a new template variable - like any other "as"-capable ViewHelper. #### Caveat This ViewHelper passes the subject directly to array_column and as such it *does not support dotted paths in either key argument to extract sub-properties*. That means it *does not support Extbase enties as input unless you explicitly implemented ArrayAccess on the model of the entity and even then support is limited to first level properties' values without dots in their names*.
Inheritance: extends TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper, use trait FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait, use trait FluidTYPO3\Vhs\Traits\ArrayConsumingViewHelperTrait
Exibir arquivo Open project: fluidtypo3/vhs

Public Methods

Method Description
initializeArguments ( ) : void
render ( ) : mixed

Method Details

initializeArguments() public method

public initializeArguments ( ) : void
return void

render() public method

public render ( ) : mixed
return mixed