You are here

function template_preprocess_views_foundation_orbit in Views Foundation 7.4

Same name and namespace in other branches
  1. 7 theme/views_foundation.theme.inc \template_preprocess_views_foundation_orbit()

Theme the Foundation Orbit Slider.

File

theme/views_foundation.theme.inc, line 11
The theme system, which controls the output of views foundation plugins.

Code

function template_preprocess_views_foundation_orbit(&$variables) {
  if (variable_get('views_foundation_orbit', 1)) {

    // Add JavaScript file.
    drupal_add_js(check_url(variable_get('views_foundation_js')) . '/foundation/foundation.orbit.js', array(
      'type' => 'file',
      'group' => -999,
      'scope' => 'footer',
    ));
  }
  $variables['captions'] = array();

  // Add caption field to $variables array if it is selected.
  if (!empty($variables['options']['caption_field'])) {
    foreach ($variables['view']->style_plugin->rendered_fields as $index => $row) {
      foreach ($row as $key => $value) {
        if ($key == $variables['options']['caption_field']) {
          $variables['captions'][$index] = $value;
        }
      }
    }
  }
  unset($variables['options']['uses_fields'], $variables['options']['caption_field'], $variables['options']['grouping']);

  // Prepare orbit slider settings.
  foreach ($variables['options'] as $key => $value) {
    $options[] = $key . ':' . $value;
  }
  $variables['options'] = implode('; ', $options);
}