Skip to content

Kirby 5.1.1

$page->hasAudio()

Checks if the Files collection has any audio files

$page->hasAudio(): bool

Return type

bool

This method modifies the existing $page object it is applied to and returns it again.

Parent class

Kirby\Cms\Page

What is an audio file?

Kirby considers the following file types as audio files:

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

Examples

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

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