Skip to content

Kirby 5.1.1

$page->hasVideos()

Checks if the Files collection has any videos

$page->hasVideos(): 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 a video file?

Kirby considers the following file types as video:

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

Examples

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

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