You are here

public function BrightcoveVideo::getField in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php \Drupal\media_entity_brightcove\Plugin\MediaEntity\Type\BrightcoveVideo::getField()
  2. 3.x modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php \Drupal\media_entity_brightcove\Plugin\MediaEntity\Type\BrightcoveVideo::getField()

Gets a media-related field/value.

Parameters

MediaInterface $media: Media object.

string $name: Name of field to fetch.

Return value

mixed Field value or FALSE if data unavailable.

Overrides MediaTypeInterface::getField

1 call to BrightcoveVideo::getField()
BrightcoveVideo::getDefaultName in modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php
Provide a default name for the media.

File

modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php, line 88

Class

BrightcoveVideo
Defines video field type for media.

Namespace

Drupal\media_entity_brightcove\Plugin\MediaEntity\Type

Code

public function getField(MediaInterface $media, $name) {
  switch ($name) {
    case 'thumbnail':
      return $this
        ->thumbnail($media);
    case 'name':
      return $this
        ->getVideoEntity($media)
        ->getName();
    case 'complete':
      break;
    case 'description':
      return $this
        ->getVideoEntity($media)
        ->getDescription();
    case 'long_description':
      return $this
        ->getVideoEntity($media)
        ->getLongDescription();
    case 'reference_id':
      return $this
        ->getVideoEntity($media)
        ->getReferenceId();
    case 'state':
      break;
    case 'tags':
      return $this
        ->getVideoEntity($media)
        ->getTags();
    case 'custom_fields':
      return $this
        ->getVideoEntity($media)
        ->getCustomFieldValues();
    case 'geo':
      break;
    case 'geo.countries':
      return $this
        ->getVideoEntity($media)->geo_countries->value;
    case 'geo.exclude_countries':
      return $this
        ->getVideoEntity($media)->geo_exclude_countries->value;
    case 'geo.restricted':
      return $this
        ->getVideoEntity($media)->geo_restricted->value;
    case 'schedule':
      break;
    case 'starts_at':
      return $this
        ->getVideoEntity($media)
        ->getScheduleStartsAt();
    case 'ends_at':
      return $this
        ->getVideoEntity($media)
        ->getScheduleEndsAt();
    case 'picture_thumbnail':
      return $this
        ->thumbnail($media);
    case 'picture_poster':
      return $this
        ->getVideoEntity($media)
        ->getPoster();
    case 'video_source':
      return $this
        ->getVideoEntity($media)
        ->getVideoUrl();
    case 'economics':
      return $this
        ->getVideoEntity($media)
        ->getEconomics();
    case 'partner_channel':
      break;
  }
  return NULL;
}