$page->hasDocuments()
Checks if the Files collection has any document files
$page->hasDocuments(): bool
Return type
bool
This method modifies the existing $page
object it is applied to and returns it again.
Parent class
What is a document file?
Kirby considers the following file types as document:
- csv
- doc
- docx
- dotx
- indd
- md
- mdown
- ppt
- pptx
- rtf
- txt
- xl
- xls
- xlsx
- xltx
Examples
echo $page->hasDocuments(); //returns the number of documents in the folder
if ($page->hasDocuments()) {
$documents = $page->documents();
}