$files->has()
Checks if the given object or id is in the collection
$files->has(string|Kirby\Cms\File $key): bool
Parameters
| Name | Type | Default |
|---|---|---|
| $keyrequired | stringorKirby\Cms\File |
no default value |
Return type
bool
This method modifies the existing $files object it is applied to and returns it again.
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 ?>