You are here

public function BrightcoveVideo::setPoster in Brightcove Video Connect 8

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

Sets the video's poster image.

Parameters

array|null $poster: The poster image which needs to be saved on the entity.

Return value

\Drupal\brightcove\BrightcoveVideoInterface The called Brightcove Video.

Overrides BrightcoveVideoInterface::setPoster

File

src/Entity/BrightcoveVideo.php, line 462

Class

BrightcoveVideo
Defines the Brightcove Video entity.

Namespace

Drupal\brightcove\Entity

Code

public function setPoster($poster) {

  // Handle image deletion here as well.
  $poster_to_delete = $this
    ->getPoster();
  if (is_null($poster) && !empty($poster_to_delete['target_id'])) {
    $this
      ->deleteFile($poster_to_delete['target_id']);
  }
  $this
    ->set('poster', $poster);
  return $this;
}