Skip to content

Kirby 3.5.7.1

$pages->pluck()

Extracts all values for a single field into a new array

$pages->pluck(string $field, string $split = null, bool $unique = false): array

Parameters

Name Type Default
$field * string
$split string null
$unique bool false

Return type

array

Parent class

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

Example

<ul>
  <?php foreach($page->children()->pluck('title') as $title): ?>
    <li><?= html($title) ?></li>
  <?php endforeach ?>
</ul>