You are here

function theme_panopoly_spotlight_wrapper in Panopoly Widgets 7

Theme function for the spotlight wrapper

1 theme call to theme_panopoly_spotlight_wrapper()
panopoly_widgets_field_formatter_view in ./panopoly_widgets.spotlight.inc
Implements hook_field_formatter_view().

File

./panopoly_widgets.spotlight.inc, line 460
A specification for the custom spotlight entity that is part of Panopoly Widgets

Code

function theme_panopoly_spotlight_wrapper($variables) {
  $output = '';
  $items = $variables['element']['#items'];
  $duration = $variables['element']['#duration'];
  $pager_style = $variables['element']['#pager_style'];
  $element = array();
  $output .= '<div class="panopoly-spotlight-widget-wrapper">';

  // Assemble the tabs header
  $output .= '<div class="panopoly-spotlight-buttons-wrapper" data-rotation-time="' . $duration * 1000 . '">';
  if (count($items) > 1) {
    if ($pager_style == 'full') {
      $output .= '<ul>';
    }
    else {

      // We're not displaying a full pager but we still want to put the links
      // in the DOM, because the Javascript depends on them.
      $output .= '<ul style="display: none;">';
    }
    foreach ($items as $delta => $item_data) {
      $slide_id = drupal_html_id('panopoly-spotlight-' . $delta);
      $variables['element']['slides'][$delta]['#slide_id'] = $slide_id;
      $output .= '<li>' . '<a href="#' . $slide_id . '">' . ($delta + 1) . '</a></li>';
    }
    $output .= '</ul>';
    if (variable_get('panopoly_widgets_spotlight_pause_play_buttons', 1) || $pager_style == 'mini') {
      $output .= '<div class="panopoly-spotlight-function-buttons">';

      // Have to split up previous and next so that we can squeeze pause between them if needed.
      if ($pager_style == 'mini') {
        $output .= '<a href="#" class="panopoly-spotlight-previous">' . t('Prev') . '</a>';
      }
      if (variable_get('panopoly_widgets_spotlight_pause_play_buttons', 1)) {
        $output .= '<a href="#" class="panopoly-spotlight-pause-play">' . t('Pause') . '</a>';
      }
      if ($pager_style == 'mini') {
        $output .= '<a href="#" class="panopoly-spotlight-next">' . t('Next') . '</a>';
      }
      $output .= '</div>';
    }
  }
  $output .= '</div>';

  // class="panopoly-spotlight-buttons-wrapper"
  $output .= render($variables['element']['slides']);
  $output .= '</div>';

  // class="panopoly-spotlight-widget-wrapper"
  return $output;
}