You are here

function theme_shadowbox_formatter in Shadowbox 7.4

Same name and namespace in other branches
  1. 8 shadowbox.module \theme_shadowbox_formatter()
  2. 7.3 shadowbox.module \theme_shadowbox_formatter()

Returns HTML for a field formatted with shadowbox.

Parameters

$variables: An associative array containing:

  • innerHTML: The html inside the shadowbox link.
  • url: The shadowbox link url.
  • rel: The rel attribute for shadowbox link.
  • title: The title attribute for shadowbox link.
  • class: The class attribute for the wrapper.
3 theme calls to theme_shadowbox_formatter()
file_shadowbox_field_formatter_view in file_shadowbox/file_shadowbox.module
Implements hook_field_formatter_view().
image_shadowbox_field_formatter_view in image_shadowbox/image_shadowbox.module
Implements hook_field_formatter_view().
insert_shadowbox_insert_content in insert_shadowbox/insert_shadowbox.module

File

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

Code

function theme_shadowbox_formatter($variables) {

  // The inner HTML. Can be a thumbnail, ico, ...
  $output = $variables['innerHTML'];

  // the link
  $link_attributes = array(
    'rel' => $variables['rel'],
    'title' => $variables['title'],
  );
  $options = array(
    'attributes' => $link_attributes,
    'html' => TRUE,
  );
  $output = l($output, $variables['url'], $options);

  // wrap shadowbox link into a div layer
  $output = '<div class="' . $variables['class'] . '"' . ($variables['innerHTML'] == '' ? ' style="display:none;"' : '') . '>' . $output . '</div>';
  return $output;
}