SortOperation
class SortOperation extends AbstractOperation (View source)
"sort" operation working on ContentRepository nodes.
Sorts nodes by specified node properties.
Properties
static protected string | $shortName | {@inheritdoc} |
Methods
bool
canEvaluate(mixed $context)
{@inheritdoc}
void
evaluate(FlowQuery $flowQuery, array $arguments)
{@inheritdoc}
Details
bool
canEvaluate(mixed $context)
{@inheritdoc}
We can only handle ContentRepository Nodes.
void
evaluate(FlowQuery $flowQuery, array $arguments)
{@inheritdoc}
First argument is the node property to sort by. Works with internal arguments (_xyz) as well. Second argument is the sort direction (ASC or DESC). Third optional argument are the sort options (see https://www.php.net/manual/en/function.sort):
- 'SORT_REGULAR'
- 'SORT_NUMERIC'
- 'SORT_STRING'
- 'SORT_LOCALE_STRING'
- 'SORT_NATURAL'
- 'SORT_FLAG_CASE' (use as last option with SORT_STRING, SORT_LOCALE_STRING or SORT_NATURAL) A single sort option can be supplied as string. Multiple sort options are supplied as array. Other than the above listed sort options throw an error. Omitting the third parameter leaves FlowQuery sort() in SORT_REGULAR sort mode. Example usages: sort("title", "ASC", ["SORT_NATURAL", "SORT_FLAG_CASE"]) sort("risk", "DESC", "SORT_NUMERIC")