You are here

public function BrightcoveVideo::setThumbnail in Brightcove Video Connect 8.2

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

Sets the video's thumbnail image.

Parameters

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

Return value

\Drupal\brightcove\BrightcoveVideoInterface The called Brightcove Video.

Overrides BrightcoveVideoInterface::setThumbnail

File

src/Entity/BrightcoveVideo.php, line 496

Class

BrightcoveVideo
Defines the Brightcove Video entity.

Namespace

Drupal\brightcove\Entity

Code

public function setThumbnail($thumbnail) {

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