$files->filterBy()
Alias for Kirby\Toolkit\Collection::filter
Parameters
Name | Type | Default |
---|---|---|
$args | mixed |
null |
Return type
This method does not modify the existing $files
object but returns a new object with the changes applied. Learn more →
Parent class
Kirby\Cms\Files
inherited from Kirby\Toolkit\Collection
Values for $args
$args
can be a string, true
, false
or a combination of a filter method and an argument. In case of the in
or not in
filters, the third argument must be an array.
Examples
Available filter methods
Method | Function |
---|---|
== |
all values that match exactly |
!= |
all values that don't match |
in |
takes an array as parameter, matches all values that are included in the array |
not in |
takes an array as parameter, matches all values that are not included in the array |
> |
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 |
*= |
all values that contain the given string |
!*= |
all values that don't contain the given string |
^= |
all values that start with the given string |
!^= |
all values that don't start with the given string |
$= |
all values that end with the given string |
!$= |
all values that don't end with the given string |
* |
all values that match the given regular expression |
!* |
all values that don't match the given regular expression |
between or ..
|
takes an array as parameter with two parameters; first is the min value, second is the max value |
maxlength |
all values that have the given maximum length |
minlength |
all values that have the given minimum length |
maxwords |
all values that have the given maximum amount of words |
minwords |
all values that have the given minimum amount of words |
date == (added in 3.4.0) |
all date values that exactly match the given date string |
date != (added in 3.4.0) |
all date values that don't match the given date string |
date > (added in 3.4.0) |
all date values that are later than the given date string |
date >= (added in 3.4.0) |
all date values that are later or equal the given date string |
date < (added in 3.4.0) |
all date values that are earlier than the given date string |
date <= (added in 3.4.0) |
all date values that are earlier or equal the given date string |
date between or date .. (added in 3.4.0) |
all date values that are between the given date strings |