function theme_shadowbox_formatter in Shadowbox 8
Same name and namespace in other branches
- 7.4 shadowbox.module \theme_shadowbox_formatter()
- 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()
- 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 260 - 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;
}