Reference

Guide

$pages->files()

Returns all files of all children

$pages->files(): Kirby\Cms\Files

Return type

Kirby\Cms\Files

Examples

<?php foreach($pages->files() as $file) : ?>
  <img src="<?= $file->url() ?>">
<?php endforeach ?>

To only get files of a certain type, you can filter by type, e.g.

$pages->files()->filterBy('type', 'image');
$pages->files()->filterBy('type', 'video');

Source code

kirby/src/Cms/Pages.php#L170