$files->findBy()
Find a single element by an attribute and its value
$files->findBy(string $attribute, mixed $value): mixed|null
Parameters
Name | Type | Default | Description |
---|---|---|---|
$attribute |
string |
– | |
$value |
mixed |
– |
Return type
mixed
|null
Example
<?php
if($file = $page->files()->findBy('filename', 'myfile.jpg')) {
echo $file->url();
?>
Inherited from
Kirby\Toolkit\Collection