$collection->filterBy($field [, $operator], $value [, $split])

Filters the current collection by a field, operator and search value

  • $field (string)
    Any field or method
  • $operator (string)
    See list of filter methods below; if not a valid filter method the second parameter will be the value
  • $value (mixed)
  • $split (string)
    Character to split by while filtering
  • return ($collection)

Available filter methods

Method Function
== all values that match exactly
in takes an array as parameter, matches all values that are included in the array (added in Kirby 2.3.2)
!= all values that don't match
not in takes an array as parameter, matches all values that are not included in the array (added in Kirby 2.3.2)
*= all values that contain the given string
> all values that are greater than the given value
>= all values that are greater or equal the given value
< all values that are smaller than the given value
<= all values that are smaller or equal the given value

Is something missing or incorrect? Edit this page on Github…