Skip to content

Kirby 3.6.6

$files->findBy()

Find a single element by an attribute and its value

$files->findBy(string $attribute, mixed $value): mixed|null

Parameters

Name Type Default
$attribute * string
$value * mixed

Return type

mixed|null

Parent class

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

Example

<?php
if($file = $page->files()->findBy('filename', 'myfile.jpg')) {
  echo $file->url();
?>