Skip to content

Kirby 5.1.1

$collection->prepend()

Prepends an element to the data array

$collection->prepend(string|TValue ...$args): Kirby\Cms\Collection

Parameters

Name Type Default
...$args stringorTValue no default value

Return type

Kirby\Cms\Collection

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

Parent class

Kirby\Cms\Collection

Examples

$collection->prepend($object);
$collection->prepend('key', $object);