function theme_photoswipe_image_formatter in PhotoSwipe 7
Same name and namespace in other branches
- 7.2 photoswipe.theme.inc \theme_photoswipe_image_formatter()
Returns HTML for an Photoswipe image field formatter.
Parameters
$variables: An associative array containing:
- item: An array of image data.
- image_style: An optional image style.
- path: An array containing the link 'path' and link 'options'.
1 theme call to theme_photoswipe_image_formatter()
- photoswipe_field_formatter_view in ./
photoswipe.module - Implements hook_field_formatter_view().
File
- ./
photoswipe.theme.inc, line 19 - Photoswipe theme functions.
Code
function theme_photoswipe_image_formatter($variables) {
$item = $variables['item'];
$node = $variables['node'];
$field = $variables['field'];
$settings = $variables['display_settings'];
$alt = !empty($item['alt']) ? $item['alt'] : '';
$title = !empty($item['title']) ? $item['title'] : '';
if (empty($alt) && !empty($item['field_file_image_alt_text'][LANGUAGE_NONE])) {
$alt = $item['field_file_image_alt_text'][LANGUAGE_NONE][0]['value'];
}
if (empty($title) && !empty($item['field_file_image_title_text'][LANGUAGE_NONE])) {
$title = $item['field_file_image_title_text'][LANGUAGE_NONE][0]['value'];
}
$image = array(
'path' => $item['uri'],
'alt' => $alt,
'title' => $title,
'style_name' => $settings['photoswipe_node_style'],
);
if (isset($item['width']) && isset($item['height'])) {
$image['width'] = $item['width'];
$image['height'] = $item['height'];
}
if ($style_name = $settings['photoswipe_image_style']) {
$path = image_style_url($style_name, $image['path']);
}
else {
$path = file_create_url($image['path']);
}
return theme('photoswipe_imagefield', array(
'image' => $image,
'path' => $path,
));
}