Reference

Guide

$page->hasVideos()

Checks if the Files collection has any videos

$page->hasVideos(): bool

Return type

bool

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

Source code

kirby/src/Cms/HasFiles.php#L170