Skip to content

Kirby 4.1.2

$files->has()

Checks if the given object or id is in the collection

$files->has(string|object $key): bool

Parameters

Name Type Default
$key * string|object

Return type

bool

Parent class

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

<?php if($page->files()->has('myimage.jpg')): ?>
There exists a file with the filename `myimage.jpg`
<?php endif ?>