Skip to content

Kirby 3.5.7.1

$pages->prepend()

Prepends an element to the data array

$pages->prepend(mixed $args = null): Kirby\Cms\Collection

Parameters

Name Type Default
$args mixed null

Return type

Kirby\Cms\Collection

Parent class

Kirby\Cms\Pages inherited from Kirby\Cms\Collection

Example

$collection = page('projects')->children()->limit(1);

foreach(page('projects')->children()->offset(1) as $key => $child) {
  $collection->prepend($key, $child);
}