$pages->pluck()
Extracts all values for a single field into a new array
$pages->pluck(string $field, string|null $split = null, bool $unique = false): array
Parameters
| Name | Type | Default |
|---|---|---|
| $fieldrequired | string |
no default value |
| $split | stringornull |
null
|
| $unique | bool |
false
|
Return type
array
This method modifies the existing $pages object it is applied to and returns it again.
Parent class
Kirby\Cms\Pages
inherited from Kirby\Toolkit\Collection
Examples
<ul>
<?php foreach($page->children()->pluck('title') as $title): ?>
<li><?= html($title) ?></li>
<?php endforeach ?>
</ul>