You are here

function theme_rotating_banner_slide in Rotating Banner 7.2

Same name and namespace in other branches
  1. 7 rotating_banner.module \theme_rotating_banner_slide()

Creates HTML for the individual slides

Parameters

{Array} variables: Array of properties associated with the slide

Return value

{String} A string that when printed produces HTML.

2 theme calls to theme_rotating_banner_slide()
rotating_banner_slide_form in ./rotating_banner.admin.inc
Form callback to edit a rotating banner slide.
theme_rotating_banner in ./rotating_banner.module

File

./rotating_banner.module, line 573

Code

function theme_rotating_banner_slide($variables) {
  $banner = $variables['banner'];
  $background_image = $variables['background_image'];
  $link = $variables['link'];

  // The following check was added because json_decode behavior is
  // inconsistent across versions of PHP.  Details can be found here
  // http://php.net/manual/en/function.json-decode.php
  if (is_string($variables['textboxes'])) {
    $textboxes = drupal_json_decode($variables['textboxes']);
  }
  else {
    $textboxes = $variables['textboxes'];
  }
  $layout = $variables['layout'];
  $tallest = $variables['tallest'];
  $first = $variables['first'];
  $fluid = $banner->settings['fluid'];
  $image_url = '';
  $textbox_output = '';
  if ($textboxes) {
    foreach ($textboxes as $textbox) {
      $textbox['layout'] = $layout;
      $textbox['link'] = $link;
      $textbox_output .= theme('rotating_banner_slide_textbox', $textbox);
    }
  }

  // Get ready to output the HTML.
  $contents = '';

  // We need the wrapper even if their aren't textboxes so that the banner edit form has something to prepend new ones to.
  $contents .= '<div class="' . $layout . ' layout-wrapper"';
  if ($link) {
    $contents .= ' data-link="' . url($link) . '"';
  }
  $contents .= '>' . "\n\t";
  if ($textbox_output) {
    $contents .= $textbox_output;
  }
  $contents .= '</div>' . "\n";
  if ($background_image) {
    $contents .= theme('rotating_banner_slide_image', array(
      'background_image' => $background_image,
      'link' => $link,
    ));
  }

  // First slide in the set.
  if ($first) {
    $first = "rb-first-slide";
  }
  else {
    $first = '';
  }
  if ($fluid) {
    $fluid = 'fluid';
  }
  else {
    $fluid = 'static';
  }
  return '<div class="rb-slide ' . $layout . ' ' . $tallest . ' ' . $first . ' ' . $fluid . '">' . "\n\t" . $contents . '</div>' . "\n";
}