function template_preprocess_views_foundation_orbit in Views Foundation 7
Same name and namespace in other branches
- 7.4 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) {
// Give each Orbit slider a unique id.
$orbit_id = $variables['view']->vid . $variables['view']->current_display;
$variables['orbit_id'] = $orbit_id;
$variables['options']['captions'] = FALSE;
// 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'][] = check_plain(strip_tags($value));
}
}
}
$variables['options']['captions'] = TRUE;
}
// Prepare orbit slider settings.
extract($variables['options']);
$options['viewsFoundation'] = array(
$orbit_id => array(
'animation' => check_plain($animation),
'animationSpeed' => (int) $animation_speed,
'advanceSpeed' => (int) $advance_speed,
'directionalNav' => (bool) $directional_nav,
'timer' => (bool) $timer,
'fluid' => $fluid == 'true' ? TRUE : check_plain($fluid),
'bullets' => (bool) $bullets,
'captions' => $captions,
),
);
// Add JavaScript files.
$path = drupal_get_path('module', 'views_foundation');
drupal_add_js(check_url(variable_get('views_foundation_js')) . '/jquery.foundation.orbit.js');
drupal_add_js($path . '/views.foundation.js', array(
'group' => JS_THEME,
));
// Add Orbit settings.
drupal_add_js($options, 'setting');
}