You are here

public static function oEmbedThumbnail::preRenderThumbnail in oEmbed 8

File

src/Element/oEmbedThumbnail.php, line 32

Class

oEmbedThumbnail
Class oEmbedThumbnail @package Drupal\oembed\Render\Element

Namespace

Drupal\oembed\Element

Code

public static function preRenderThumbnail($element) {

  // Only act when the oEmbed response is true.
  if (!empty($element['#printed'])) {
    return $element;
  }

  /** @var \Bangpound\oEmbed\Response\Response $embed */
  $embed = $element['#embed'];

  // Check if the oEmbed response provides a thumbnail image.
  if (empty($embed
    ->getThumbnailUrl())) {
    $element['#printed'] = TRUE;
    return $element;
  }
  self::oembed_pre_render_image_helper($element);
  return $element;
}