Skip to content

Kirby 4.2.0

$files->first()

Returns the first element

$files->first(): mixed

Return type

mixed

Parent class

Kirby\Cms\Files inherited from Kirby\Toolkit\Collection

Example

<?php if($file = $page->files()->first()) {
  echo $file->filename();
} ?>