You are here

protected function BrightcoveVideo::provideDefaultValuesForImageField in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 src/Entity/BrightcoveVideo.php \Drupal\brightcove\Entity\BrightcoveVideo::provideDefaultValuesForImageField()
  2. 3.x src/Entity/BrightcoveVideo.php \Drupal\brightcove\Entity\BrightcoveVideo::provideDefaultValuesForImageField()

Helper function to provide default values for image fields.

The original and the save entity's field arrays is a bit different from each other, so provide the missing values.

Parameters

array &$values: The field's values array.

2 calls to BrightcoveVideo::provideDefaultValuesForImageField()
BrightcoveVideo::getPoster in src/Entity/BrightcoveVideo.php
Returns the video's poster image.
BrightcoveVideo::getThumbnail in src/Entity/BrightcoveVideo.php
Returns the video's thumbnail image.

File

src/Entity/BrightcoveVideo.php, line 106

Class

BrightcoveVideo
Defines the Brightcove Video entity.

Namespace

Drupal\brightcove\Entity

Code

protected function provideDefaultValuesForImageField(array &$values) {

  /** @var \Drupal\file\Entity\File $file */
  foreach ($values as $delta => &$value) {
    $file = File::load($value['target_id']);
    if (!is_null($file)) {
      $value += [
        'display' => $file->status->value,
        'description' => '',
        'upload' => '',
      ];
    }
  }
}