You are here

function oembed_pre_render_image_helper in oEmbed 7

Same name and namespace in other branches
  1. 7.0 oembed.module \oembed_pre_render_image_helper()

Set the properties for a themed image.

This function takes the element by reference because it should never be called as a pre render function despite appearances.

1 call to oembed_pre_render_image_helper()
oembed_pre_render_thumbnail in ./oembed.module
Change oEmbed request into a thumbnail.

File

./oembed.module, line 429
Core functionality for oEmbed

Code

function oembed_pre_render_image_helper(&$element, $prefix = '') {
  $embed = $element['#embed'];
  $element['#path'] = $embed[$prefix . 'url'];
  $element['#alt'] = oembed_alt_attr($embed);
  $element['#title'] = $embed['title'];
  $element['#height'] = isset($embed[$prefix . 'height']) ? $embed[$prefix . 'height'] : NULL;
  $element['#width'] = isset($embed[$prefix . 'width']) ? $embed[$prefix . 'width'] : NULL;

  // theme_image() prefers width, height, alt and title element properties over
  // attributes so we manually override them if an associated attribute is set.
  foreach (array(
    'width',
    'height',
    'alt',
    'title',
  ) as $key) {
    if (isset($element['#attributes'][$key])) {
      $element['#' . $key] = $element['#attributes'][$key];
    }
  }
}