You are here

protected function VideoEmbedField::getVideoUrl in Video Embed Field 8

Get the video URL from a media entity.

Parameters

\Drupal\media_entity\MediaInterface $media: The media entity.

Return value

string|bool A video URL or FALSE on failure.

2 calls to VideoEmbedField::getVideoUrl()
VideoEmbedField::getField in modules/video_embed_media/src/Plugin/MediaEntity/Type/VideoEmbedField.php
Gets a media-related field/value.
VideoEmbedField::loadProvider in modules/video_embed_media/src/Plugin/MediaEntity/Type/VideoEmbedField.php
Load a video provider given a media entity.

File

modules/video_embed_media/src/Plugin/MediaEntity/Type/VideoEmbedField.php, line 180

Class

VideoEmbedField
Provides media type plugin for video embed field.

Namespace

Drupal\video_embed_media\Plugin\MediaEntity\Type

Code

protected function getVideoUrl(MediaInterface $media) {
  $field_name = empty($this->configuration['source_field']) ? VideoEmbedField::VIDEO_EMBED_FIELD_DEFAULT_NAME : $this->configuration['source_field'];
  $video_url = $media->{$field_name}->value;
  return !empty($video_url) ? $video_url : FALSE;
}