Skip to content

Kirby 3.9.8

$nestcollection->group()

Groups the elements by a given field or callback function

$nestcollection->group(string|\Closure $field, bool $i = true): Kirby\Toolkit\Collection

Parameters

Name Type Default
$field * string|Closure
$i bool true

Return type

Kirby\Toolkit\Collection

Exceptions

Type Description
Exception if $field is not a string nor a callback function

Parent class

Kirby\Cms\NestCollection inherited from Kirby\Toolkit\Collection