You are here

function oembed_resolve_link in oEmbed 7

Same name and namespace in other branches
  1. 7.0 oembed.filter.inc \oembed_resolve_link()

PREG replace callback finds [embed] shortcodes, URLs and request options.

Override in Drupal system variable `oembed_resolve_link_callback`

Parameters

string $url: URL to embed.

array $options: oEmbed request options.

Return value

string Rendered oEmbed response.

See also

MediaInternetOEmbedHandler::preSave().

1 call to oembed_resolve_link()
_oembed_resolve_link in ./oembed_legacy.inc
1 string reference to 'oembed_resolve_link'
oembed_preg_tag_replace in ./oembed.filter.inc
PREG replace callback finds [embed] shortcodes, URLs and request options.

File

./oembed.filter.inc, line 187
Input filter that enhances oEmbed enabled URLs with extra content

Code

function oembed_resolve_link($url, $options = array()) {
  $url = decode_entities($url);
  $element = array();
  $matches = array();
  if ($provider = oembed_get_provider($url, $matches)) {
    $embed = oembed_get_data($url);
    if ($embed) {
      $element = oembed_render_element('oembed', $url, $options);
    }
  }
  $return = drupal_render($element);
  if (empty($return)) {
    $return = $url;
  }
  return $return;
}