You are here

function theme_shadowbox_thumbnail in Shadowbox 8

Same name and namespace in other branches
  1. 7.4 shadowbox.module \theme_shadowbox_thumbnail()

Returns an image.

Parameters

$variables: An associative array containing:

  • path: The uri || url of the image.
  • image_style: An optional image style.
  • attributes: An optional array of attributes.
  • title: The title to use on the image.
  • alt: An optional alt attribute.
3 theme calls to theme_shadowbox_thumbnail()
FileShadowboxFormatter::viewElements in file_shadowbox/lib/Drupal/file_shadowbox/Plugin/Field/FieldFormatter/FileShadowboxFormatter.php
Builds a renderable array for a field value.
ImageShadowboxFormatter::viewElements in image_shadowbox/lib/Drupal/image_shadowbox/Plugin/Field/FieldFormatter/ImageShadowboxFormatter.php
Builds a renderable array for a field value.
insert_shadowbox_insert_content in insert_shadowbox/insert_shadowbox.module

File

./shadowbox.module, line 298
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function theme_shadowbox_thumbnail($variables) {
  $image_style = $variables['image_style'];
  if ($image_style) {
    $output = array(
      '#theme' => 'image_style',
      '#style_name' => $image_style,
      '#uri' => $variables['path'],
      '#alt' => $variables['alt'] ? $variables['alt'] : $variables['title'],
      '#title' => $variables['title'],
      '#attributes' => array(
        'class' => array(
          'image-' . $image_style,
        ),
      ),
    );
  }
  else {
    $output = array(
      '#theme' => 'image',
      '#uri' => $variables['path'],
      '#alt' => $variables['alt'] ? $variables['alt'] : $variables['title'],
      '#title' => $variables['title'],
      '#attributes' => $variables['attributes'],
    );
  }
  return drupal_render($output);
}