name . '-' . $view->current_display; $settings = $options['views_slideshow_singleframe']; // Cast the strings into int or bool as necessary. $new_settings = array(); foreach ($settings as $key => $value) { if (is_string($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($vars['rows']), 'id_prefix' => '#views_slideshow_singleframe_main_', 'div_prefix' => '#views_slideshow_singleframe_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['setting'] AS $current_setting) { if (isset($current_setting['viewsSlideshowSingleFrame'])) { $current_keys = array_keys($current_setting['viewsSlideshowSingleFrame']); if (stristr($current_keys[0], '#views_slideshow_singleframe_main_' . $vss_id)) { $slideshow_count++; } } } if ($slideshow_count > 1) { $vss_id .= '-' . $slideshow_count; $settings['vss_id'] = $vss_id; } drupal_add_js(array('viewsSlideshowSingleFrame' => array('#views_slideshow_singleframe_main_' . $vss_id => $settings)), 'setting'); $hidden_elements = theme('views_slideshow_singleframe_no_display_section', $view, $rows, $vss_id, $options['mode']); $vars['slideshow'] = theme('views_slideshow_main_section', $vss_id, $hidden_elements, 'views_slideshow_singleframe'); $singleframe = $vars['options']['views_slideshow_singleframe']; // Only show controls when there is more than one result. $vars['controls_top'] = ''; $vars['controls_bottom'] = ''; if ($settings['num_divs'] > 1) { if ($singleframe['controls'] == 1) { $vars['controls_top'] = theme('views_slideshow_singleframe_controls', $vss_id, $view, $options); } elseif ($singleframe['controls'] == 2) { $vars['controls_bottom'] = theme('views_slideshow_singleframe_controls', $vss_id, $view, $options); } } $vars['pager_top'] = ''; $vars['pager_bottom'] = ''; if ($singleframe['pager'] == 1) { $vars['pager_top'] = theme('views_slideshow_singleframe_pager', $vss_id, $view, $options); } elseif ($singleframe['pager'] == 2) { $vars['pager_bottom'] = theme('views_slideshow_singleframe_pager', $vss_id, $view, $options); } $vars['image_count_top'] = ''; $vars['image_count_bottom'] = ''; if ($singleframe['image_count'] == 1) { $vars['image_count_top'] = theme('views_slideshow_singleframe_image_count', $vss_id, $view, $options); } elseif ($singleframe['image_count'] == 2) { $vars['image_count_bottom'] = theme('views_slideshow_singleframe_image_count', $vss_id, $view, $options); } } /** * Add the HTML for the hidden slideshow elements. * * @ingroup themeable */ function theme_views_slideshow_singleframe_no_display_section($view, $rows, $vss_id, $mode) { // Retrive the number of itmes per frame if (isset($view->display_handler->display->display_options['style_options']['views_slideshow_singleframe']['items_per_slide']) && $view->display_handler->display->display_options['style_options']['views_slideshow_singleframe']['items_per_slide'] > 0) { $items_per_slide = $view->display_handler->display->display_options['style_options']['views_slideshow_singleframe']['items_per_slide']; } elseif (isset($view->display['default']->display_options['style_options']['views_slideshow_singleframe']['items_per_slide']) && $view->display['default']->display_options['style_options']['views_slideshow_singleframe']['items_per_slide'] > 0) { $items_per_slide = $view->display['default']->display_options['style_options']['views_slideshow_singleframe']['items_per_slide']; } else { $items_per_slide = 1; } // Add the slideshow elements. $attributes['id'] = "views_slideshow_singleframe_teaser_section_" . $vss_id; $attributes['class'] = 'views_slideshow_singleframe_teaser_section'; $attributes = drupal_attributes($attributes); $output = "