Skip to content

Kirby 4.2.0

$page->hasVideos()

Checks if the Files collection has any videos

$page->hasVideos(): bool

Return type

bool

Parent class

Kirby\Cms\Page

Example

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

if($page->hasImages()) {
  $videos = $page->videos();
}
?>

What is a video file?

Kirby considers the following file types as video:

  • mov
  • movie
  • avi
  • ogg
  • ogv
  • webm
  • flv
  • swf
  • mp4
  • m4v
  • mpg
  • mpe