$value) { if (is_string($value)) { if (stristr($value, "\n")) { $value = str_replace("\n", ' ', $value); } $value = trim($value); if (is_numeric($value)) { $value = (int)$value; } elseif (strtolower($value) == 'true') { $value = TRUE; } elseif (strtolower($value) == 'false') { $value = FALSE; } } $new_settings[$key] = $value; } $settings = array_merge( array( 'num_divs' => sizeof($rows), 'id_prefix' => '#views_slideshow_cycle_main_', 'div_prefix' => '#views_slideshow_cycle_div_', 'vss_id' => $vss_id, ), $new_settings ); // We need to go through the current js setting values to make sure the one we // want to add is not already there. If it is already there then append -[num] // to the id to make it unique. $slideshow_count = 1; $current_settings = drupal_add_js(); foreach ($current_settings['settings']['data'] AS $current_setting) { if (isset($current_setting['viewsSlideshowCycle'])) { $current_keys = array_keys($current_setting['viewsSlideshowCycle']); if (stristr($current_keys[0], '#views_slideshow_cycle_main_' . $vss_id)) { $slideshow_count++; } } } if ($slideshow_count > 1) { $vss_id .= '-' . $slideshow_count; $settings['vss_id'] = $vss_id; } drupal_add_js(array('viewsSlideshowCycle' => array('#views_slideshow_cycle_main_' . $vss_id => $settings)), 'setting'); // Add the hoverIntent plugin. if (isset($settings['advanced_pagerevent']) && $settings['advanced_pagerevent'] == 'hoverIntent') { if (module_exists('jq')) { $loaded_plugins = jq_plugins(); if (!empty($loaded_plugins['hoverIntent'])) { jq_add('hoverIntent'); } } if (module_exists('hoverintent')) { hoverintent_add(); } } // Add the slideshow elements. $vars['classes_array'][] = 'views_slideshow_cycle_teaser_section'; $styles = ''; if (isset($view->display_handler->display->display_options['style_options']['views_slideshow_cycle'])) { $styles = $view->display_handler->display->display_options['style_options']['views_slideshow_cycle']; } $styles_default = ''; if (isset($view->display['default']->display_options['style_options']['views_slideshow_cycle'])) { $styles_default = $view->display['default']->display_options['style_options']['views_slideshow_cycle']; } // Retrive the number of items per frame if (isset($styles['items_per_slide']) && $styles['items_per_slide'] > 0) { $items_per_slide = $styles['items_per_slide']; } elseif (isset($styles_default['items_per_slide']) && $styles_default['items_per_slide'] > 0) { $items_per_slide = $styles_default['items_per_slide']; } else { $items_per_slide = 1; } $vars['items_per_slide'] = $items_per_slide; $items = array(); $slideshow_count = 0; $rendered_rows = ''; foreach ($rows as $count => $item) { $items[] = $item; if (count($items) == $items_per_slide || $count == (count($rows)-1)) { $rendered_rows .= theme('views_slideshow_cycle_main_frame_row', array('vss_id' => $vss_id, 'items' => $items, 'count' => $slideshow_count)); $items = array(); $slideshow_count++; } } $vars['rendered_rows'] = $rendered_rows; } /** * Views Slideshow slideshow rows. * * @ingroup themeable */ function template_preprocess_views_slideshow_cycle_main_frame_row(&$vars) { $current = $vars['count'] + 1; $vars['classes_array'][] = 'views_slideshow_cycle_slide'; $vars['classes_array'][] = 'views_slideshow_slide views-row-' . $current; if ($vars['count']) { $vars['classes_array'][] = 'views_slideshow_cycle_hidden'; } $vars['classes_array'][] = ($vars['count'] % 2) ? 'views-row-even' : 'views-row-odd'; $vars['rendered_items'] = ''; foreach ($vars['items'] as $item_count => $item) { $vars['rendered_items'] .= theme('views_slideshow_cycle_main_frame_row_item', array('item' => $item, 'item_count' => $item_count)); } } function template_preprocess_views_slideshow_cycle_main_frame_row_item(&$vars) { $vars['classes_array'][] = 'views-row views-row-' . $vars['item_count']; if (!$vars['item_count']) { $vars['classes_array'][] = 'views-row-first'; } if ($vars['item_count'] % 2) { $vars['classes_array'][] = 'views-row-even'; } else { $vars['classes_array'][] = 'views-row-odd'; } }