$files->get()
Getter
$files->get(string $key, mixed $default = null): Kirby\Cms\File|mixed|null
Parameters
Name | Type | Default |
---|---|---|
$keyrequired | string |
no default value |
$default | mixed |
null
|
Return types
Kirby\Cms\File
ormixed
ornull
This method modifies the existing $files
object it is applied to and returns it again.
Parent class
Kirby\Cms\Files
inherited from Kirby\Toolkit\Collection
Examples
<?php
if ($file = $page->files()->get('photography/landscape/hobbits-and-stuff.jpg')):
echo $file->url();
endif;
?>