Index: views_slideshow.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/views_slideshow.module,v retrieving revision 1.11.2.2.2.12.2.3 diff -u -p -r1.11.2.2.2.12.2.3 views_slideshow.module --- views_slideshow.module 21 Dec 2010 08:57:38 -0000 1.11.2.2.2.12.2.3 +++ views_slideshow.module 21 Dec 2010 23:25:06 -0000 @@ -38,24 +38,24 @@ function views_slideshow_theme($existing 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'rows' => array(), 'settings' => array(), 'location' => NULL), 'file' => 'theme/views_slideshow.theme.inc', ), - 'views_slideshow_controls' => array( + 'views_slideshow_controls_text_render' => array( 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'rows' => array(), 'settings' => array(), 'location' => NULL), - 'template' => 'theme/views-slideshow-controls', + 'template' => 'theme/views-slideshow-controls-text', 'file' => 'theme/views_slideshow.theme.inc', ), - 'views_slideshow_controls_previous' => array( + 'views_slideshow_controls_text_previous' => array( 'arguments' => array('vss_id' => '', 'view' => NULL, 'settings' => array()), - 'template' => 'theme/views-slideshow-controls-previous', + 'template' => 'theme/views-slideshow-controls-text-previous', 'file' => 'theme/views_slideshow.theme.inc', ), - 'views_slideshow_controls_pause' => array( + 'views_slideshow_controls_text_pause' => array( 'arguments' => array('vss_id' => '', 'view' => NULL, 'settings' => array()), - 'template' => 'theme/views-slideshow-controls-pause', + 'template' => 'theme/views-slideshow-controls-text-pause', 'file' => 'theme/views_slideshow.theme.inc', ), - 'views_slideshow_controls_next' => array( + 'views_slideshow_controls_text_next' => array( 'arguments' => array('vss_id' => '', 'view' => NULL, 'settings' => array()), - 'template' => 'theme/views-slideshow-controls-next', + 'template' => 'theme/views-slideshow-controls-text-next', 'file' => 'theme/views_slideshow.theme.inc', ), 'views_slideshow_slide_counter_widget_render' => array( @@ -106,7 +106,7 @@ function views_slideshow_init() { function views_slideshow_views_slideshow_js_method_register() { return array( 'views_slideshow_pager_fields', - 'views_slideshow_controls', + 'views_slideshow_controls_text', 'views_slideshow_slide_counter', ); } @@ -168,7 +168,9 @@ function views_slideshow_pager_views_sli foreach ($pagers as $pager_key => $pager_title) { $function = $pager_key . '_views_slideshow_widget_pager_form_options'; - call_user_func_array($function, $arguments); + if (function_exists($function)) { + call_user_func_array($function, $arguments); + } } } else { @@ -246,6 +248,64 @@ function views_slideshow_pager_fields_vi } /** + * Implements [widget]_views_slideshow_widget_form_options(). + */ +function views_slideshow_controls_views_slideshow_widget_form_options(&$form, &$form_state, &$view, $defaults, $dependency) { + // Get all the pager info from other modules. + // hook_views_slideshow_controls_settings($view, $option_values, $dependency_prefix) + $controls = module_invoke_all('views_slideshow_widget_controls_settings', $view); + + if (!empty($controls)) { + asort($controls); + + // Create the widget type field. + $form['type'] = array( + '#type' => 'select', + '#title' => t('Controls Type'), + '#description' => t('Style of the controls'), + '#default_value' => $defaults['type'], + '#options' => $controls, + '#process' => array('views_process_dependency'), + '#dependency' => array($dependency . '-enable' => array(1)), + ); + + // Add any additional form elements + // Build our arguments to pass to + // [pager-type]_views_slideshow_widget_pager_form_options + $arguments = array( + &$form, + &$form_state, + &$view, + $defaults, + $dependency, + ); + + foreach ($controls as $control_key => $control_title) { + $function = $control_key . '_views_slideshow_widget_controls_form_options'; + if (function_exists($function)) { + call_user_func_array($function, $arguments); + } + } + } + else { + $form['enable_controls'] = array( + '#value' => 'There are no controls available.', + ); + } +} + +/** + * Implementation of hook_views_slideshow_controls_settings + */ +function views_slideshow_views_slideshow_widget_controls_settings($view) { + $settings = array( + 'views_slideshow_controls_text' => t('Text'), + ); + + return $settings; +} + +/** * Implements hook_views_slideshow_option_definition. */ function views_slideshow_views_slideshow_option_definition() { @@ -275,6 +335,8 @@ function views_slideshow_views_slideshow $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_thumbnails_click_to_page'] = array('default' => 0); $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_fields_fields'] = array('default' => array()); $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_fields_hover'] = array('default' => 0); + + $options['widgets']['contains'][$location]['contains']['views_slideshow_controls']['contains']['type'] = array('default' => 0); } return $options; Index: js/views_slideshow.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/js/views_slideshow.js,v retrieving revision 1.3.4.3 diff -u -p -r1.3.4.3 views_slideshow.js --- js/views_slideshow.js 18 Dec 2010 06:42:15 -0000 1.3.4.3 +++ js/views_slideshow.js 21 Dec 2010 23:25:06 -0000 @@ -1,26 +1,26 @@ Drupal.behaviors.viewsSlideshow = function (context) { // Process previous link - $('.views_slideshow_controls_previous:not(.views-slideshow-controls-previous-processed)', context).addClass('views-slideshow-controls-previous-processed').each(function() { - var uniqueID = $(this).attr('id').replace('views_slideshow_controls_previous_', ''); + $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() { + var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', ''); $(this).click(function() { - viewsSlideshowPreviousSlide(uniqueID, 'views_slideshow_controls'); + viewsSlideshowPreviousSlide(uniqueID, ''); return false; }); }); // Process next link - $('.views_slideshow_controls_next:not(.views-slideshow-controls-next-processed)', context).addClass('views-slideshow-controls-next-processed').each(function() { - var uniqueID = $(this).attr('id').replace('views_slideshow_controls_next_', ''); + $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() { + var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', ''); $(this).click(function() { - viewsSlideshowNextSlide(uniqueID, 'views_slideshow_controls'); + viewsSlideshowNextSlide(uniqueID, ''); return false; }); }); // Process pause link - $('.views_slideshow_controls_pause:not(.views-slideshow-controls-pause-processed)', context).addClass('views-slideshow-controls-pause-processed').each(function() { - var uniqueID = $(this).attr('id').replace('views_slideshow_controls_pause_', ''); + $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() { + var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', ''); $(this).click(function() { if (Drupal.settings.viewsSlideshow[uniqueID].paused) { viewsSlideshowPlay(uniqueID, ''); @@ -56,19 +56,19 @@ Drupal.behaviors.viewsSlideshow = functi } /** - * Implement hook_viewsSlideshowPause for pager fields pager. + * Implement hook_viewsSlideshowPause for text controls. */ -function views_slideshow_pager_fields_viewsSlideshowPause(slideshowID) { +function views_slideshow_controls_text_viewsSlideshowPause(slideshowID) { var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : ''; - $('#views_slideshow_controls_pause_' + slideshowID).text(pauseText); + $('#views_slideshow_controls_text_pause_' + slideshowID).text(pauseText); } /** - * Implement hook_viewsSlideshowPlay for pager fields pager. + * Implement hook_viewsSlideshowPlay for text controls. */ -function views_slideshow_pager_fields_viewsSlideshowPlay(slideshowID) { +function views_slideshow_controls_text_viewsSlideshowPlay(slideshowID) { var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : ''; - $('#views_slideshow_controls_pause_' + slideshowID).text(playText); + $('#views_slideshow_controls_text_pause_' + slideshowID).text(playText); } // Theme control pause. Index: theme/views_slideshow.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/theme/Attic/views_slideshow.theme.inc,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 views_slideshow.theme.inc --- theme/views_slideshow.theme.inc 18 Dec 2010 06:42:15 -0000 1.1.2.2 +++ theme/views_slideshow.theme.inc 21 Dec 2010 23:25:06 -0000 @@ -171,7 +171,7 @@ function template_preprocess_views_slide function theme_views_slideshow_controls_widget_render($vss_id, $view, $rows, $settings, $location) { $output = ''; if (count($rows) > 1) { - $output = theme('views_slideshow_controls', $vss_id, $view, $rows, $settings, $location); + $output = theme($settings['type'] . '_render', $vss_id, $view, $rows, $settings, $location); } return $output; @@ -182,15 +182,15 @@ function theme_views_slideshow_controls_ * * @ingroup themeable */ -function template_preprocess_views_slideshow_controls(&$vars) { - $vars['attributes']['class'] = 'views_slideshow_controls'; - $vars['attributes']['id'] = "views_slideshow_controls_" . $vars['vss_id']; +function template_preprocess_views_slideshow_controls_text_render(&$vars) { + $vars['attributes']['class'] = 'views_slideshow_controls_text'; + $vars['attributes']['id'] = "views_slideshow_controls_text_" . $vars['vss_id']; - $vars['rendered_control_previous'] = theme('views_slideshow_controls_previous', $vars['vss_id'], $vars['view'], $vars['settings']); + $vars['rendered_control_previous'] = theme('views_slideshow_controls_text_previous', $vars['vss_id'], $vars['view'], $vars['settings']); - $vars['rendered_control_pause'] = theme('views_slideshow_controls_pause', $vars['vss_id'], $vars['view'], $vars['settings']); + $vars['rendered_control_pause'] = theme('views_slideshow_controls_text_pause', $vars['vss_id'], $vars['view'], $vars['settings']); - $vars['rendered_control_next'] = theme('views_slideshow_controls_next', $vars['vss_id'], $vars['view'], $vars['settings']); + $vars['rendered_control_next'] = theme('views_slideshow_controls_text_next', $vars['vss_id'], $vars['view'], $vars['settings']); } /** @@ -198,9 +198,9 @@ function template_preprocess_views_slide * * @ingroup themeable */ -function template_preprocess_views_slideshow_controls_previous(&$vars) { - $vars['attributes']['class'] = 'views_slideshow_controls_previous'; - $vars['attributes']['id'] = 'views_slideshow_controls_previous_' . $vars['vss_id']; +function template_preprocess_views_slideshow_controls_text_previous(&$vars) { + $vars['attributes']['class'] = 'views_slideshow_controls_text_previous'; + $vars['attributes']['id'] = 'views_slideshow_controls_text_previous_' . $vars['vss_id']; } /** @@ -208,9 +208,9 @@ function template_preprocess_views_slide * * @ingroup themeable */ -function template_preprocess_views_slideshow_controls_pause(&$vars) { - $vars['attributes']['class'] = 'views_slideshow_controls_pause'; - $vars['attributes']['id'] = 'views_slideshow_controls_pause_' . $vars['vss_id']; +function template_preprocess_views_slideshow_controls_text_pause(&$vars) { + $vars['attributes']['class'] = 'views_slideshow_controls_text_pause'; + $vars['attributes']['id'] = 'views_slideshow_controls_text_pause_' . $vars['vss_id']; $vars['start_text'] = t('Pause'); } @@ -219,9 +219,9 @@ function template_preprocess_views_slide * * @ingroup themeable */ -function template_preprocess_views_slideshow_controls_next(&$vars) { - $vars['attributes']['class'] = 'views_slideshow_controls_next'; - $vars['attributes']['id'] = 'views_slideshow_controls_next_' . $vars['vss_id']; +function template_preprocess_views_slideshow_controls_text_next(&$vars) { + $vars['attributes']['class'] = 'views_slideshow_controls_text_next'; + $vars['attributes']['id'] = 'views_slideshow_controls_text_next_' . $vars['vss_id']; } /**