You are here

public function EmbedButton::getIconUrl in Embed 8

Returns the URL of the button's icon.

If no icon file is associated with this Embed Button entity, the embed type plugin's default icon is used.

Return value

string The URL of the button icon.

Overrides EmbedButtonInterface::getIconUrl

File

src/Entity/EmbedButton.php, line 127

Class

EmbedButton
Defines the EmbedButton entity.

Namespace

Drupal\embed\Entity

Code

public function getIconUrl() {
  if (!empty($this->icon)) {
    $uri = $this->icon['uri'];
    if (!is_file($uri) && !UrlHelper::isExternal($uri)) {
      static::convertEncodedDataToImage($this->icon);
    }
    $uri = file_create_url($uri);
  }
  else {
    $uri = $this
      ->getTypePlugin()
      ->getDefaultIconUrl();
  }
  return file_url_transform_relative($uri);
}