You are here

public function BrightcoveVideo::setRelatedLink in Brightcove Video Connect 8.2

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

Sets the video's related link.

Parameters

array|null $related_link: The related link.

Return value

\Drupal\brightcove\BrightcoveVideoInterface The called Brightcove Video.

Overrides BrightcoveVideoInterface::setRelatedLink

File

src/Entity/BrightcoveVideo.php, line 348

Class

BrightcoveVideo
Defines the Brightcove Video entity.

Namespace

Drupal\brightcove\Entity

Code

public function setRelatedLink($related_link) {

  // If the protocol is missing from the link add default http protocol to
  // the link.
  if (!empty($related_link['uri']) && !preg_match('/[\\w-]+:\\/\\//i', $related_link['uri'])) {
    $related_link['uri'] = "http://{$related_link['uri']}";
  }
  $this
    ->set('related_link', $related_link);
  return $this;
}