You are here

function theme_colorbox_imagefield in Colorbox 7

Same name and namespace in other branches
  1. 6 colorbox.theme.inc \theme_colorbox_imagefield()
  2. 7.2 colorbox.theme.inc \theme_colorbox_imagefield()

Returns HTML for an image using a specific Colorbox 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 Colorbox.
  • title: The title text that will be used as a caption in the Colorbox.
  • gid: Gallery id for Colorbox image grouping.
1 theme call to theme_colorbox_imagefield()
theme_colorbox_image_formatter in ./colorbox.theme.inc
Returns HTML for an Colorbox image field formatter.

File

./colorbox.theme.inc, line 125
Colorbox theme functions.

Code

function theme_colorbox_imagefield($variables) {
  $class = array(
    'colorbox',
  );
  if ($variables['image']['style_name'] == 'hide') {
    $image = '';
    $class[] = 'js-hide';
  }
  elseif (!empty($variables['image']['style_name'])) {
    $image = theme('image_style', $variables['image']);
  }
  else {
    $image = theme('image', $variables['image']);
  }
  $options = array(
    'html' => TRUE,
    'attributes' => array(
      'title' => $variables['title'],
      'class' => implode(' ', $class),
      'rel' => $variables['gid'],
    ),
  );
  return l($image, $variables['path'], $options);
}