Package

ViewHelpers

ViewHelper Documentation

v:iterator.sort

Sorts an instance of ObjectStorage, an Iterator implementation, an Array or a QueryResult (including Lazy counterparts).

Can be used inline, i.e.: <f:for each="{dataset -> vhs:iterator.sort(sortBy: 'name')}" as="item"> // iterating data which is ONLY sorted while rendering this particular loop </f:for>

Arguments

subject anySimpleType

An array or Iterator implementation to sort

as string

Which variable to update in the TemplateVariableContainer. If left out, returns sorted data instead of updating the variable (i.e. reference or copy)

sortBy string

Which property/field to sort by - leave out for numeric sorting based on indexes(keys)

order string

ASC, DESC, RAND or SHUFFLE. RAND preserves keys, SHUFFLE does not - but SHUFFLE is faster

sortFlags string

Constant name from PHP for `SORT_FLAGS`: `SORT_REGULAR`, `SORT_STRING`, `SORT_NUMERIC`, `SORT_NATURAL`, `SORT_LOCALE_STRING` or `SORT_FLAG_CASE`. You can provide a comma seperated list or array to use a combination of flags.

ViewHelper Resources

Schema Resources