Skip to content

Kirby 5.0.4

$api->collection()

Setter and getter for an API collection

$api->collection(string $name, Kirby\Toolkit\Collection|array|null $collection = null): Kirby\Api\Collection

Parameters

Name Type Default
$namerequired string no default value
$collection Kirby\Toolkit\Collectionorarrayornull null

Return type

Kirby\Api\Collection

This method modifies the existing $api object it is applied to and returns it again.

Exceptions

Type Description
Kirby\Exception\NotFoundException If no collection for $name exists
Exception

Parent class

Kirby\Cms\Api inherited from Kirby\Api\Api