You are here

function theme_panopoly_spotlight_view in Panopoly Widgets 7

Theme function for spotlight items

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

File

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

Code

function theme_panopoly_spotlight_view($variables) {
  $output = '';
  $title = $variables['element']['#items']['title'];
  $description = $variables['element']['#items']['description'];
  $link = $variables['element']['#items']['link'];
  $alt = $variables['element']['#items']['alt'];
  $settings = $variables['element']['#settings'];
  $delta = $variables['element']['#delta'];
  $slide_id = isset($variables['element']['#slide_id']) ? $variables['element']['#slide_id'] : 'panopoly-spotlight-' . $delta;
  $image = $variables['element']['#items']['image'];
  $image_markup = theme('image_style', array(
    'style_name' => $settings['image_style'],
    'path' => $image->uri,
    'alt' => $alt,
  ));
  $output = '<div id="' . $slide_id . '" class="' . 'panopoly-spotlight' . '">';
  if ($link) {
    $output .= l($image_markup, $link, array(
      'html' => TRUE,
    ));
  }
  else {
    $output .= $image_markup;
  }
  $output .= '<div class="panopoly-spotlight-wrapper">';
  if (!empty($title)) {
    $output .= '<h3 class="panopoly-spotlight-label">' . (empty($link) ? check_plain($title) : l($title, $link)) . '</h3>';
  }
  if (!empty($description)) {
    $output .= '<div class="panopoly-spotlight-info">';
    $output .= '<p>' . $description . '</p>';
    $output .= '</div>';
  }
  $output .= '</div>';
  $output .= '</div>';
  return $output;
}