You are here

function theme_photoswipe_imagefield in PhotoSwipe 7.2

Same name and namespace in other branches
  1. 7 photoswipe.theme.inc \theme_photoswipe_imagefield()

Returns HTML for an image using a specific Photoswipe image style.

Parameters

$variables: An associative array containing:

  • image: image item as array.
  • path: The path of the image that should be displayed in the Photoswipe.
1 theme call to theme_photoswipe_imagefield()
theme_photoswipe_image_formatter in ./photoswipe.theme.inc
Returns HTML for an Photoswipe image field formatter.

File

./photoswipe.theme.inc, line 99
Photoswipe theme functions.

Code

function theme_photoswipe_imagefield($variables) {
  $class = array(
    'photoswipe',
  );
  if (!empty($variables['image']['style_name'])) {
    if ($variables['image']['style_name'] == 'hide') {
      $image = '<!-- hidden image -->';
    }
    else {
      $image = theme('image_style', $variables['image']);
    }
  }
  else {
    $image = theme('image', $variables['image']);
  }
  $options = array(
    'html' => TRUE,
    'attributes' => array(
      'class' => implode(' ', $class),
      'data-size' => $variables['dimensions'],
      'data-overlay-title' => $variables['caption'],
    ),
  );
  return l($image, $variables['path'], $options);
}