You are here

function theme_juicebox_embed_markup in Juicebox HTML5 Responsive Image Galleries 7.2

Same name and namespace in other branches
  1. 7 themes/juicebox.theme.inc \theme_juicebox_embed_markup()

Returns HTML for embedding a Juicebox gallery.

Parameters

array $variables: An associative array containing variables used to render this HTML.

File

themes/juicebox.theme.inc, line 18
Theme related functions for processing output related to Juicebox galleries.

Code

function theme_juicebox_embed_markup(&$variables) {
  $settings = $variables['settings'];
  $output = '';

  // Create the gallery embed markup. This is what the Juicebox javascript will
  // use to generate the final gallery markup.
  $output .= '<div class="' . trim('juicebox-parent ' . $settings['custom_parent_classes']) . '">' . "\n";
  $output .= render($variables['c_links']);
  $output .= '<div id="' . $variables['gallery_id'] . '" class="juicebox-container">' . "\n";

  // Also create a search engine friendly version of the gallery. This markup
  // will only be seen by crawlers and users with javascript disabled.
  $bypass_noscript = array_key_exists('addseocontent', $variables['gallery_options']) && $variables['gallery_options']['addseocontent'] == 'FALSE';
  if (!$bypass_noscript) {
    $output .= '<noscript>' . "\n";
    $output .= '<!-- Image gallery content for non-javascript devices -->' . "\n";
    if (array_key_exists('gallerytitle', $variables['gallery_options'])) {
      $output .= '<h1 class="jb-name">' . $variables['gallery_options']['gallerytitle'] . '</h1>' . "\n";
    }
    if (array_key_exists('gallerydescription', $variables['gallery_options'])) {
      $output .= '<p class="jb-description">' . $variables['gallery_options']['gallerydescription'] . '</p>' . "\n";
    }
    foreach ($variables['gallery_images'] as $image) {
      $img_vars = array();
      $img_vars['path'] = $image['src_data']['imageURL'];
      if (!empty($image['title'])) {
        $img_vars['title'] = $image['title'];
        $image['title'] = '<span class="jb-title">' . $image['title'] . '</span><br/>';
      }
      if (!empty($image['caption'])) {
        $img_vars['alt'] = $image['caption'];
        $image['caption'] = '<span class="jb-caption">' . $image['caption'] . '</span>';
      }
      $output .= '<p class="jb-image">' . theme('image', $img_vars) . '<br/>' . $image['title'] . $image['caption'] . '</p>' . "\n";
    }
    $output .= '</noscript>' . "\n";
  }
  $output .= '</div></div>' . "\n";
  return $output;
}