You are here

public function Vimeo::iframe in Video Filter 8

HTML5 video (iframe).

Overrides VideoFilterBase::iframe

File

src/Plugin/VideoFilter/Vimeo.php, line 47

Class

Vimeo
Provides Vimeo codec for Video Filter.

Namespace

Drupal\video_filter\Plugin\VideoFilter

Code

public function iframe($video) {
  $video_id = !empty($video['codec']['matches'][1]) ? (int) $video['codec']['matches'][1] : '';
  if (empty($video_id)) {

    // Support for editor picks video embed.
    $video_id = !empty($video['codec']['matches'][2]) ? (int) $video['codec']['matches'][2] : '';
  }
  return [
    'src' => '//player.vimeo.com/video/' . $video_id . '?' . implode('&', $this
      ->attributes($video)),
    'properties' => [
      'webkitallowfullscreen' => 'true',
      'mozallowfullscreen' => 'true',
      'allowfullscreen' => 'true',
    ],
  ];
}