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 -> v:iterator.sort(sortBy: 'name')}" as="item">
    // iterating data which is ONLY sorted while rendering this particular loop
</f:for>

Arguments

subject

DataType
mixed
Required
false
Description
The array/Traversable instance to sort

sortBy

DataType
string
Required
false
Description
Which property/field to sort by - leave out for numeric sorting based on indexes(keys)

order

DataType
string
Default
‘ASC’
Required
false
Description
ASC, DESC, RAND or SHUFFLE. RAND preserves keys, SHUFFLE does not - but SHUFFLE is faster

sortFlags

DataType
string
Default
‘SORT_REGULAR’
Required
false
Description
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.

as

DataType
string
Required
false
Description
Template variable name to assign; if not specified the ViewHelper returns the variable instead.