Skip to content

Kirby 5.0.4

$collection->prepend()

Prepends an element to the data array

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

Parameters

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

Return type

Kirby\Toolkit\Collection

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

Parent class

Kirby\Toolkit\Collection

Examples

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