Skip to content

Kirby 4.1.2

collection()

Returns the result of a collection by name

collection(string $name, array $options = [ ]): Kirby\Toolkit\Collection|null

Parameters

Name Type Default
$name * string
$options array [ ]

Return type

Kirby\Toolkit\Collection|null

Examples

<?php
$customCollection = collection('projects');
dump($customCollection);

See also: Defining collections