You are here

function theme_picture_formatter in Picture 7

Same name and namespace in other branches
  1. 7.2 picture.module \theme_picture_formatter()

Theme picture.

3 theme calls to theme_picture_formatter()
picture_file_formatter_picture_view in ./picture.file_entity_1.inc
'view callback' for hook_file_formatter_info().
_picture_filter_prepare_image in ./picture.module
Prepares a Render Array for theme_picture_formatter(). It is similar to picture_field_formatter_view() with modifications for inline images.
_picture_filter_process in ./picture.module
Process callback for inline image filter.

File

./picture.module, line 828
Picture formatter.

Code

function theme_picture_formatter($variables) {
  if (!isset($variables['breakpoints']) || empty($variables['breakpoints'])) {
    return theme('image_formatter', $variables);
  }
  $item = $variables['item'];

  // Do not output an empty 'title' attribute.
  if (isset($item['title']) && drupal_strlen($item['title']) == 0) {
    unset($item['title']);
  }
  $item['style_name'] = $variables['image_style'];
  $item['breakpoints'] = $variables['breakpoints'];
  $item['attributes'] = $variables['attributes'];
  if (!isset($item['path']) && isset($variables['uri'])) {
    $item['path'] = $variables['uri'];
  }
  $output = theme('picture', $item);
  if (is_array($variables['path']) && isset($variables['path']['path'])) {
    $path = $variables['path']['path'];
    $options = isset($variables['path']['options']) ? $variables['path']['options'] : array();
    $options['html'] = TRUE;
    $output = l($output, $path, $options);
  }
  return $output;
}