You are here

public static function oEmbed::preRenderFetch in oEmbed 8

File

src/Element/oEmbed.php, line 48

Class

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

Namespace

Drupal\oembed\Element

Code

public static function preRenderFetch($element) {
  $embed = oembed_get_data($element['#url'], $element['#parameters']);

  // Prevent rendering if the response is bad.
  if (!$embed) {
    $element['#printed'] = TRUE;
    return $element;
  }
  $element['#embed'] = $embed;
  return $element;
}