Skip to content

Kirby 6.0.1

$nestCollection->set()

Adds a new element to the collection

$nestCollection->set(array|string $key, NestCollection|NestObject|Field|null $value = null): NestCollection

Parameters

Name Type Default
$keyrequired arrayorstring no default value
$value Kirby\Cms\NestCollectionorKirby\Cms\NestObjectorKirby\Content\Fieldornull null

Return type

Kirby\Cms\NestCollection

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

Parent class

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