Skip to content

$page->hasAudio()

Checks if the Files collection has any audio files

$page->hasAudio(): bool

Return type

bool

Parent class

Kirby\Cms\Page

Example

<?php
echo $page->hasAudio(); //will echo 1 if true, nothing if false

if($page->hasAudio()) {
  $audio = $page->audio();
}
?>

What is an audio file?

Kirby considers the following file types as audio files:

  • mp3
  • m4a
  • wav
  • aif
  • aiff
  • midi