Skip to content

Kirby 4.1.2

$field->toFiles()

Returns a file collection from a yaml list of filenames in the field

$field->toFiles(string $separator = 'yaml'): Kirby\Cms\Files

Parameters

Name Type Default
$separator string 'yaml'

Return type

Kirby\Cms\Files

Example

<?php foreach ($page->gallery()->toFiles() as $image): ?>
  <img src="<?= $image->url() ?>" alt="<?= $image->alt() ?>">
<?php endif ?>