? theme
? contrib/views_slideshow_default_pagers_controls
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.1
diff -u -p -r1.11.2.2.2.12.2.1 views_slideshow.module
--- views_slideshow.module 20 Apr 2010 22:04:17 -0000 1.11.2.2.2.12.2.1
+++ views_slideshow.module 9 Dec 2010 00:40:05 -0000
@@ -13,8 +13,16 @@ function views_slideshow_theme($existing
return array(
'views_slideshow_main_section' => array(
'arguments' => array('id' => NULL, 'hidden_elements' => NULL, 'plugin' => NULL),
- 'file' => 'views_slideshow.theme.inc',
+ 'file' => 'theme/views_slideshow.theme.inc',
),
+ 'views_slideshow_pager' => array(
+ 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'settings' => array(), 'theme_function' => NULL, 'location' => NULL),
+ 'file' => 'theme/views_slideshow.theme.inc',
+ ),
+ 'views_slideshow_controls' => array(
+ 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'settings' => array(), 'theme_function' => NULL, 'location' => NULL),
+ 'file' => 'theme/views_slideshow.theme.inc',
+ )
);
}
@@ -44,12 +52,163 @@ function views_slideshow_help($path, $ar
}
/**
- * Views Slideshow: preprocess function for the slideshow.
+ * Implements hook_views_slideshow_widget_info().
+ */
+function views_slideshow_views_slideshow_widget_info() {
+ return array(
+ 'views_slideshow_pager' => 'Pager',
+ 'views_slideshow_controls' => 'Controls',
+ 'views_slideshow_slide_counter' => 'Slide Counter',
+ );
+}
+
+/**
+ * Implementation of hook_views_slideshow_skins().
+ */
+function views_slideshow_views_slideshow_skins() {
+ $skins['default'] = array(
+ 'title' => t('Default'),
+ );
+
+ return $skins;
+}
+
+/**
+ * Implements [widget]_views_slideshow_widget_form_options().
*/
-function template_preprocess_views_slideshow(&$vars) {
- $options = $vars['options'];
- if (in_array($options['mode'], array('singleframe', 'thumbnailhover', 'menu', 'ddblock', 'slider'))) {
- $options['mode'] = 'views_slideshow_' . $options['mode'];
+function views_slideshow_pager_views_slideshow_widget_form_options($form, $form_state, $view, $settings, $dependency) {
+ // Get all the pager info from other modules.
+ // hook_views_slideshow_pager_settings($view, $option_values, $dependency_prefix)
+ $pagers = module_invoke_all('views_slideshow_pager_settings', $view, $settings, $dependency . '-type');
+
+ if (!empty($pagers)) {
+ // Prep the pager options and the fields
+ foreach ($pagers as $pager_key => $pager_info) {
+ $pager_options[$pager_key] = $pager_info['title'];
+ if (isset($pager_info['fields'])) {
+ foreach ($pager_info['fields'] as $pager_field_key => $pager_field) {
+ $pager_field['#default_value'] = isset($settings[$pager_field_key]) ? $settings[$pager_field_key] : $pager_field['#default_value'];
+ $pager_field['#dependency'][$dependency . '-enable'] = array(1);
+ $pager_field['#dependency'][$dependency . '-type'] = array($pager_key);
+ $pager_field['#dependency_count'] = count($pager_field['#dependency']);
+ if (!isset($pager_field['#process']) || !in_array('views_process_dependency', $pager_field['#process'])) {
+ $pager_field['#process'][] = 'views_process_dependency';
+ }
+
+ if ($pager_field['#type'] == 'checkboxes' || $pager_field['#type'] == 'checkbox') {
+ $old_prefix = '';
+ if (isset($pager_field['#prefix'])) {
+ $old_prefix = $pager_field['#prefix'];
+ }
+ $pager_field['#prefix'] = '
';
+ }
+
+ $pager_fields[$pager_field_key] = $pager_field;
+ }
+ }
+ }
+ asort($pager_options);
+
+ // Create the widget type field.
+ $form['type'] = array(
+ '#type' => 'select',
+ '#title' => t('Pager Type'),
+ '#description' => t('Style of the pager'),
+ '#default_value' => isset($settings['type']) ? $settings['type'] : array(),
+ '#options' => $pager_options,
+ '#process' => array('views_process_dependency'),
+ '#dependency' => array($dependency . '-enable' => array(1)),
+ );
+
+ // Add user defined pager fields to the form.
+ $form = array_merge($form, $pager_fields);
+
+ }
+ else {
+ $form['enable_pager'] = array(
+ '#value' => 'There are no pagers available.',
+ );
+ }
+}
+
+/**
+ * Implementation of hook_views_slideshow_pager_settings
+ */
+function views_slideshow_views_slideshow_pager_settings($view, $option_values, $dependency_prefix) {
+ // Settings for Numbered Pager
+ $return_value['views_slideshow_pager_numbered'] = array(
+ 'title' => t('Numbered'),
+ 'fields' => array(
+ 'views_slideshow_pager_numbered_click_to_page' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Make Pager Linked to Slide Link'),
+ '#default_value' => 0,
+ '#description' => t('Should the pager use the main frame link so when it is clicked it goes to the same url that the main frame goes to when clicked.'),
+ ),
+ 'views_slideshow_pager_numbered__hover' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Activate Slide and Pause on Pager Hover'),
+ '#default_value' => 0,
+ '#description' => t('Should the slide be activated and paused when hovering over a pager item.'),
+ ),
+ ),
+ );
+
+ // Settings for Thumbnails pager.
+ $return_value['views_slideshow_pager_thumbnails'] = array(
+ 'title' => t('Thumbnails'),
+ 'fields' => array(
+ 'views_slideshow_pager_thumbnails_click_to_page' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Make Pager Linked to Slide Link'),
+ '#default_value' => 0,
+ '#description' => t('Should the pager use the main frame link so when it is clicked it goes to the same url that the main frame goes to when clicked.'),
+ ),
+ 'views_slideshow_pager_thumbnails_hover' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Activate Slide and Pause on Pager Hover'),
+ '#default_value' => 0,
+ '#description' => t('Should the slide be activated and paused when hovering over a pager item.'),
+ ),
+ ),
+ );
+
+ if ($view->row_plugin->uses_fields()) {
+ $options = array();
+ foreach ($view->display->handler->get_handlers('field') as $field => $handler) {
+ $options[$field] = $handler->ui_name();
+ }
+ $return_value['views_slideshow_pager_fields'] = array(
+ 'title' => t('Fields'),
+ 'fields' => array(
+ 'views_slideshow_pager_fields_fields' => array(
+ '#type' => 'checkboxes',
+ '#title' => t('Pager fields'),
+ '#options' => $options,
+ '#default_value' => array(),
+ '#description' => t("Choose the fields that will appear in the pager."),
+ //'#prefix' => '',
+ ),
+ 'views_slideshow_pager_fields_hover' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Activate Slide and Pause on Pager Hover'),
+ '#default_value' => isset($option_values['pager_hover']) ? $option_values['pager_hover'] : 0,
+ '#description' => t('Should the slide be activated and paused when hovering over a pager item.'),
+ ),
+ ),
+ );
}
- $vars['slideshow'] = theme($options['mode'], $vars['view'], $options, $vars['rows'], $vars['title']);
+
+ return $return_value;
}
+
Index: views_slideshow.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/Attic/views_slideshow.views.inc,v
retrieving revision 1.1.2.1.2.1.2.1
diff -u -p -r1.1.2.1.2.1.2.1 views_slideshow.views.inc
--- views_slideshow.views.inc 20 Apr 2010 22:04:17 -0000 1.1.2.1.2.1.2.1
+++ views_slideshow.views.inc 9 Dec 2010 00:40:05 -0000
@@ -23,8 +23,8 @@ function views_slideshow_views_plugins()
'parent' => 'list',
'path' => drupal_get_path('module', 'views_slideshow'),
'theme' => 'views_slideshow',
- 'theme path' => drupal_get_path('module', 'views_slideshow'),
- 'theme file' => 'views_slideshow.theme.inc',
+ 'theme path' => drupal_get_path('module', 'views_slideshow') . '/theme',
+ 'theme file' => 'theme/views_slideshow.theme.inc',
),
),
);
Index: views_slideshow_plugin_style_slideshow.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/Attic/views_slideshow_plugin_style_slideshow.inc,v
retrieving revision 1.1.2.1.2.9.2.5
diff -u -p -r1.1.2.1.2.9.2.5 views_slideshow_plugin_style_slideshow.inc
--- views_slideshow_plugin_style_slideshow.inc 5 Oct 2010 05:45:50 -0000 1.1.2.1.2.9.2.5
+++ views_slideshow_plugin_style_slideshow.inc 9 Dec 2010 00:40:05 -0000
@@ -24,13 +24,6 @@ class views_slideshow_plugin_style_slide
if ($this->uses_row_plugin() && $display->handler->get_option('row_plugin')) {
$this->row_plugin = $display->handler->get_plugin('row');
}
-
- // Eveything below here is what's needed for views slideshow.
- if (in_array($options['mode'], array('singleframe', 'thumbnailhover', 'menu', 'slider', 'ddblock')) && is_array($options[$options['mode']])) {
- foreach ($options[$options['mode']] as $index => $value) {
- $this->options['views_slideshow_' . $options['mode']][$index] = $value;
- }
- }
}
// Set default options
@@ -39,7 +32,8 @@ class views_slideshow_plugin_style_slide
$options = parent::option_definition();
$options = array_merge($options, module_invoke_all('views_slideshow_option_definition'));
- $options['mode'] = array('default' => '');
+ $options['slideshow_type'] = array('default' => '');
+ $options['slideshow_skin'] = array('default' => '');
return $options;
}
@@ -49,16 +43,47 @@ class views_slideshow_plugin_style_slide
module_load_all_includes('views_slideshow.inc');
parent::options_form($form, $form_state);
- $modules = module_invoke_all('views_slideshow_modes');
+ // Style
+ $form['slideshow_skin_header'] = array(
+ '#value' => '',
'#process' => array('views_process_dependency'),
- '#dependency' => array('edit-style-options-mode' => array($module)),
+ '#dependency' => array('edit-style-options-slideshow-type' => array($module)),
);
-
+
$form[$module] = array(
'#type' => 'fieldset',
'#title' => t('!module options', array('!module' => $modules[$module])),
'#collapsible' => TRUE,
'#attributes' => array('class' => $module),
);
- $function = $module .'_views_slideshow_options_form';
+
+ $function = $module .'_views_slideshow_type_form';
call_user_func_array($function, array(&$form, &$form_state, &$this));
$form[$module . '-suffix'] = array(
@@ -88,6 +114,57 @@ class views_slideshow_plugin_style_slide
'#value' => t('There is no Views Slideshow plugin enabled. Go to the !modules and enable a Views Slideshow plugin module. For example Views Slideshow Singleframe.', array('!modules' => l('Modules Page', 'admin/build/modules'))),
);
}
+
+ /**
+ * Widgets
+ */
+ $form['widgets'] = array(
+ '#value' => '
' . t('Widgets') . '
',
+ );
+
+ $location = array('top' => t('Top'), 'bottom' => t('Bottom'));
+ foreach ($location as $location_id => $location_name) {
+ // Widget Header
+ $form['widgets'][$location_id]['header'] = array(
+ '#value' => '' . t('!location Widgets', array('!location' => $location_name)) . '
',
+ );
+ }
+
+ $widgets = module_invoke_all('views_slideshow_widget_info');
+ if (!empty($widgets)) {
+ foreach ($widgets as $widget_id => $widget_name) {
+ foreach ($location as $location_id => $location_name) {
+ $widget_dependency = 'edit-style-options-widgets-' . $location_id . '-' . str_replace('_', '-', $widget_id);
+ // Use Widget Checkbox
+ $form['widgets'][$location_id][$widget_id . '-enable'] = array(
+ '#type' => 'checkbox',
+ '#title' => t($widget_name),
+ '#default_value' => isset($this->options['widgets'][$location_id][$widget_id]) ? $this->options['widgets'][$location_id][$widget_id] : 0,
+ '#description' => t('Should a !name be rendered at the !location of the slides.', array('!name' => $widget_name, '!location' => $location_name)),
+ );
+
+ // Widget weight
+ $form['widgets'][$location_id][$widget_id]['weight'] = array(
+ '#type' => 'select',
+ '#title' => t('Weight of the !name', array('!name' => $widget_name)),
+ '#default_value' => isset($this->options['widgets'][$location_id][$widget_id]['weight']) ? $this->options['widgets'][$location_id][$widget_id]['weight'] : 1,
+ '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5),
+ '#description' => t('Determines in what order the !name appears. A lower weight will cause the !name to be above higher weight items.', array('!name' => $widget_name)),
+ '#process' => array('views_process_dependency'),
+ '#dependency' => array($widget_dependency . '-enable' => array(1)),
+ );
+
+ if (!isset($this->options['widgets'][$location_id][$widget_id])) {
+ $this->options['widgets'][$location_id][$widget_id] = array();
+ }
+
+ // Add all the widget settings.
+ if (function_exists($widget_id . '_views_slideshow_widget_form_options')) {
+ call_user_func_array($widget_id . '_views_slideshow_widget_form_options', array(&$form['widgets'][$location_id][$widget_id], $form_state, $this, $this->options['widgets'][$location_id][$widget_id], $widget_dependency));
+ }
+ }
+ }
+ }
}
function options_validate(&$form, &$form_state) {
@@ -105,4 +182,33 @@ class views_slideshow_plugin_style_slide
call_user_func_array($function, array($form, &$form_state));
}
}
+
+ /**
+ * Retrieve a list of all available skins in the system.
+ */
+ function views_slideshow_get_skins() {
+ static $skins;
+
+ if (empty($skins)) {
+ $skins = array();
+ foreach (module_implements('views_slideshow_skins') as $module) {
+ $skin_items = call_user_func($module .'_views_slideshow_skins');
+ if (isset($skin_items) && is_array($skin_items)) {
+ foreach (array_keys($skin_items) as $skin) {
+ // Ensure that the definition is complete, so we don't need lots
+ // of error checking later.
+ $skin_items[$skin] += array(
+ 'title' => t('Untitled skin'),
+ 'module' => $module,
+ 'path' => '',
+ 'stylesheets' => array(),
+ );
+ }
+ $skins = array_merge($skins, $skin_items);
+ }
+ }
+ }
+
+ return $skins;
+ }
}
Index: contrib/views_slideshow_cycle/views_slideshow_cycle.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_cycle/Attic/views_slideshow_cycle.module,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 views_slideshow_cycle.module
--- contrib/views_slideshow_cycle/views_slideshow_cycle.module 29 Sep 2010 03:07:49 -0000 1.1.2.6
+++ contrib/views_slideshow_cycle/views_slideshow_cycle.module 9 Dec 2010 00:40:05 -0000
@@ -60,42 +60,13 @@ function views_slideshow_cycle_theme($ex
'template' => 'theme/views-slideshow-cycle-control-next',
'file' => 'theme/views_slideshow_cycle.theme.inc',
),
- 'views_slideshow_cycle_pager' => array(
- 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()),
- 'file' => 'theme/views_slideshow_cycle.theme.inc',
- ),
- 'views_slideshow_cycle_pager_numbered' => array(
- 'arguments' => array('view' => NULL, 'attributes' => NULL, 'options' => array()),
- 'template' => 'theme/views-slideshow-cycle-pager-numbered',
- 'file' => 'theme/views_slideshow_cycle.theme.inc',
- ),
- 'views_slideshow_cycle_pager_thumbnails' => array(
- 'arguments' => array('view' => NULL, 'attributes' => NULL, 'options' => array()),
- 'template' => 'theme/views-slideshow-cycle-pager-thumbnails',
- 'file' => 'theme/views_slideshow_cycle.theme.inc',
- ),
- 'views_slideshow_cycle_pager_field' => array(
- 'arguments' => array('view' => NULL, 'attributes' => NULL, 'options' => array()),
- 'template' => 'theme/views-slideshow-cycle-pager-field',
- 'file' => 'theme/views_slideshow_cycle.theme.inc',
- ),
- 'views_slideshow_cycle_pager_field_field' => array(
- 'arguments' => array('view' => NULL, 'field' => NULL, 'count' => NULL),
- 'template' => 'theme/views-slideshow-cycle-pager-field-field',
- 'file' => 'theme/views_slideshow_cycle.theme.inc',
- ),
- 'views_slideshow_cycle_pager_field_item' => array(
- 'arguments' => array('item' => NULL, 'vss_id' => NULL, 'count' => NULL),
- 'template' => 'theme/views-slideshow-cycle-pager-field-item',
- 'file' => 'theme/views_slideshow_cycle.theme.inc',
- ),
'views_slideshow_cycle_slide_counter' => array(
'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()),
'template' => 'theme/views-slideshow-cycle-slide-counter',
'file' => 'theme/views_slideshow_cycle.theme.inc',
),
'views_slideshow_cycle_main_frame' => array(
- 'arguments' => array('view' => NULL, 'rows' => NULL, 'vss_id' => NULL, 'mode' => NULL),
+ 'arguments' => array('view' => NULL, 'settings' => NULL, 'rows' => NULL, 'vss_id' => NULL, 'mode' => NULL),
'template' => 'theme/views-slideshow-cycle-main-frame',
'file' => 'theme/views_slideshow_cycle.theme.inc',
),
@@ -127,14 +98,3 @@ function views_slideshow_cycle_help($pat
return $output;
}
}
-
-/**
- * Implementation of hook_views_cycle_skins().
- */
-function views_slideshow_cycle_views_slideshow_cycle_skins() {
- $skins['default'] = array(
- 'title' => t('Default'),
- );
-
- return $skins;
-}
Index: contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_cycle/Attic/views_slideshow_cycle.views_slideshow.inc,v
retrieving revision 1.1.2.14
diff -u -p -r1.1.2.14 views_slideshow_cycle.views_slideshow.inc
--- contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc 5 Oct 2010 05:45:50 -0000 1.1.2.14
+++ contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc 9 Dec 2010 00:40:05 -0000
@@ -6,7 +6,7 @@
* The default options available with Views Slideshow: cycle.
*/
-function views_slideshow_cycle_views_slideshow_modes() {
+function views_slideshow_cycle_views_slideshow_slideshow_types() {
$options = array(
'views_slideshow_cycle' => t('Cycle'),
);
@@ -164,28 +164,7 @@ function views_slideshow_cycle_views_sli
return $options;
}
-function views_slideshow_cycle_views_slideshow_options_form(&$form, &$form_state, &$view) {
-
- // Style
- $form['views_slideshow_cycle']['style'] = array(
- '#value' => '' . t('Style') . '
',
- );
-
- // Get a list of all available stylesheet plugins.
- $skin_info = views_slideshow_cycle_get_skins();
- foreach ($skin_info as $skin => $info) {
- $skins[$skin] = $info['title'];
- }
- asort($skins);
-
- // And now our own form additions.
- $form['views_slideshow_cycle']['skin'] = array(
- '#type' => 'select',
- '#title' => t('Skin'),
- '#options' => $skins,
- '#default_value' => $view->options['views_slideshow_cycle']['skin'],
- '#description' => t('Select the skin to use for this display. Skins allow for easily swappable layouts of things like next/prev links and thumbnails. Note that not all skins support thumbnails, so mis-matching skins and thumbnails may lead to unpredictable results.'),
- );
+function views_slideshow_cycle_views_slideshow_type_form(&$form, &$form_state, &$view) {
// Transition
$form['views_slideshow_cycle']['transition'] = array(
@@ -400,79 +379,10 @@ function views_slideshow_cycle_views_sli
);
// Pager and Controls
- $form['views_slideshow_cycle']['pager_and_controls'] = array(
- '#value' => '' . t('Pager and Controls') . '
',
- );
- $form['views_slideshow_cycle']['pager'] = array(
- '#type' => 'select',
- '#title' => t('Pager'),
- '#options' => array(
- 0 => t('None'),
- 'top' => t('Top'),
- 'bottom' => t('Bottom'),
- ),
- '#default_value' => $view->options['views_slideshow_cycle']['pager'],
- '#description' => t('Determine if a pager should appear and if so whether they should appear before or after the slideshow.'),
- );
-
- // Get all the pager info from other modules.
- // hook_views_slideshow_pager_settings($view, $option_values, $dependency_prefix)
- $pagers = module_invoke_all('views_slideshow_cycle_pager_settings', $view, $view->options['views_slideshow_cycle'], 'edit-style-options-views-slideshow-cycle-pager');
-
- // Prep the pager options and the fields
- $options = array();
- $pager_fields = array();
- foreach ($pagers as $pager_key => $pager_info) {
- $options[$pager_key] = $pager_info['title'];
- if (isset($pager_info['fields'])) {
- foreach ($pager_info['fields'] as $pager_field_key => $pager_field) {
- $pager_field['#dependency']['edit-style-options-views-slideshow-cycle-pager'] = array('top', 'bottom');
- $pager_field['#dependency']['edit-style-options-views-slideshow-cycle-pager-type'] = array($pager_key);
- $pager_field['#dependency_count'] = count($pager_field['#dependency']);
- if (!isset($pager_field['#process']) || !in_array('views_process_dependency', $pager_field['#process'])) {
- $pager_field['#process'][] = 'views_process_dependency';
- }
-
- $pager_fields[$pager_field_key] = $pager_field;
- }
- }
- }
-
- // Sort the options alphabetically.
- asort($options);
- $form['views_slideshow_cycle']['pager_type'] = array(
- '#type' => 'select',
- '#title' => t('Pager Type'),
- '#options' => $options,
- '#default_value' => $view->options['views_slideshow_cycle']['pager_type'],
- '#description' => t('Style of the pager.'),
- '#process' => array('views_process_dependency'),
- '#dependency' => array('edit-style-options-views-slideshow-cycle-pager' => array('top', 'bottom')),
+ $form['views_slideshow_cycle']['controls_label'] = array(
+ '#value' => '' . t('Controls') . '
',
);
-
- // Add user defined pager fields to the form.
- $form['views_slideshow_cycle'] = array_merge($form['views_slideshow_cycle'], $pager_fields);
-
- $form['views_slideshow_cycle']['pager_hover'] = array(
- '#type' => 'checkbox',
- '#title' => t('Activate Slide and Pause on Pager Hover'),
- '#default_value' => $view->options['views_slideshow_cycle']['pager_hover'],
- '#description' => t('Should the slide be activated and paused when hovering over a pager item.'),
- '#process' => array('views_process_dependency'),
- '#dependency' => array('edit-style-options-views-slideshow-cycle-pager' => array('top', 'bottom')),
- );
-
$weights = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5);
- $form['views_slideshow_cycle']['pager_weight'] = array(
- '#type' => 'select',
- '#title' => t('Weight of the Pager'),
- '#options' => $weights,
- '#default_value' => $view->options['views_slideshow_cycle']['pager_weight'],
- '#description' => t('Determines in what order the pager appears. A lower weight will cause the pager to be above higher weight items.'),
- '#process' => array('views_process_dependency'),
- '#dependency' => array('edit-style-options-views-slideshow-cycle-pager' => array('top', 'bottom')),
- );
-
$form['views_slideshow_cycle']['controls'] = array(
'#type' => 'select',
'#title' => t('Controls'),
@@ -628,63 +538,6 @@ function views_slideshow_cycle_views_sli
}
}
-/**
- * Implementation of hook_views_slideshow_cycle_pager_settings
- */
-function views_slideshow_cycle_views_slideshow_cycle_pager_settings($view, $option_values, $dependency_prefix) {
- // Settings for Numbered Pager
- $return_value['numbered'] = array(
- 'title' => t('Numbered'),
- 'fields' => array(
- 'numbered_pager_click_to_page' => array(
- '#type' => 'checkbox',
- '#title' => t('Make Pager Linked to Slide Link'),
- '#default_value' => $option_values['numbered_pager_click_to_page'],
- '#description' => t('Should the pager use the main frame link so when it is clicked it goes to the same url that the main frame goes to when clicked.'),
- ),
- ),
- );
-
- // Settings for Thumbnails pager.
- $return_value['thumbnails'] = array(
- 'title' => t('Thumbnails'),
- 'fields' => array(
- 'thumbnails_pager_click_to_page' => array(
- '#type' => 'checkbox',
- '#title' => t('Make Pager Linked to Slide Link'),
- '#default_value' => $option_values['thumbnails_pager_click_to_page'],
- '#description' => t('Should the pager use the main frame link so when it is clicked it goes to the same url that the main frame goes to when clicked.'),
- ),
- ),
- );
-
- if ($view->row_plugin->uses_fields()) {
- $options = array();
- foreach ($view->display->handler->get_handlers('field') as $field => $handler) {
- $options[$field] = $handler->ui_name();
- }
- $return_value['fields'] = array(
- 'title' => t('Fields'),
- 'fields' => array(
- 'pager_fields' => array(
- '#type' => 'checkboxes',
- '#title' => t('Pager fields'),
- '#options' => $options,
- '#default_value' => $option_values['pager_fields'],
- '#description' => t("Choose the fields that will appear in the pager."),
- '#prefix' => '',
- ),
- ),
- );
- }
-
- return $return_value;
-}
-
function views_slideshow_cycle_views_slideshow_options_form_validate(&$form, &$form_state, &$view) {
if (!is_numeric($form_state['values']['style_options']['views_slideshow_cycle']['speed'])) {
form_error($form['views_slideshow_cycle']['speed'], t('!setting must be numeric!', array('Speed')));
@@ -696,39 +549,3 @@ function views_slideshow_cycle_views_sli
form_error($form['views_slideshow_cycle']['remember_slide_days'], t('!setting must be numeric!', array('Slide days')));
}
}
-
-function views_slideshow_cycle_views_slideshow_options_form_submit($form, &$form_state) {
- // In addition to the skin, we also pre-save the definition that
- // correspond to it. That lets us avoid a hook lookup on every page.
- $skins = views_slideshow_cycle_get_skins();
- $form_state['values']['style_options']['views_slideshow_cycle']['skin_info'] = $skins[$form_state['values']['style_options']['views_slideshow_cycle']['skin']];
-}
-
-/**
- * Retrieve a list of all available skins in the system.
- */
-function views_slideshow_cycle_get_skins() {
- static $skins;
-
- if (empty($skins)) {
- $skins = array();
- foreach (module_implements('views_slideshow_cycle_skins') as $module) {
- $skin_items = call_user_func($module .'_views_slideshow_cycle_skins');
- if (isset($skin_items) && is_array($skin_items)) {
- foreach (array_keys($skin_items) as $skin) {
- // Ensure that the definition is complete, so we don't need lots
- // of error checking later.
- $skin_items[$skin] += array(
- 'title' => t('Untitled skin'),
- 'module' => $module,
- 'path' => '',
- 'stylesheets' => array(),
- );
- }
- $skins = array_merge($skins, $skin_items);
- }
- }
- }
-
- return $skins;
-}
Index: contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_cycle/theme/Attic/views_slideshow_cycle.theme.inc,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 views_slideshow_cycle.theme.inc
--- contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc 29 Sep 2010 07:18:41 -0000 1.1.2.3
+++ contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc 9 Dec 2010 00:40:05 -0000
@@ -10,12 +10,33 @@
* Implements template_preprocess_hook_THEMENAME().
*/
function template_preprocess_views_slideshow_cycle(&$vars) {
- $options = $vars['options'];
+ $skin_info = $settings['skin_info'];
+
+
+ // Enqueue any stylesheets set for the skin on this view are added.
+ $skin_path = drupal_get_path('module', $skin_info['module']);
+ if ($skin_info['path']) {
+ $skin_path .= '/'. $skin_info['path'];
+ }
+
+ if (!empty($skin_info['stylesheets'])) {
+ foreach ($skin_info['stylesheets'] as $stylesheet) {
+ drupal_add_css($skin_path .'/'. $stylesheet);
+ }
+ }
+}
+
+/**
+ * Views Slideshow: Theme the main frame wrapper.
+ *
+ * @ingroup themeable
+ */
+
+function template_preprocess_views_slideshow_cycle_main_frame(&$vars) {
+ $settings = $vars['settings'];
$rows = $vars['rows'];
$view = $vars['view'];
- $vss_id = $view->name . '-' . $view->current_display;
- $settings = $options['views_slideshow_cycle'];
- $skin_info = $settings['skin_info'];
+ $vss_id = $vars['vss_id'];
// Cast the strings into int or bool as necessary.
$new_settings = array();
@@ -51,7 +72,7 @@ function template_preprocess_views_slide
$settings = array_merge(
array(
- 'num_divs' => sizeof($vars['rows']),
+ 'num_divs' => sizeof($rows),
'id_prefix' => '#views_slideshow_cycle_main_',
'div_prefix' => '#views_slideshow_cycle_div_',
'vss_id' => $vss_id,
@@ -92,84 +113,19 @@ function template_preprocess_views_slide
hoverintent_add();
}
}
-
- // Enqueue any stylesheets set for the skin on this view are added.
- $skin_path = drupal_get_path('module', $skin_info['module']);
- if ($skin_info['path']) {
- $skin_path .= '/'. $skin_info['path'];
- }
-
- if (!empty($skin_info['stylesheets'])) {
- foreach ($skin_info['stylesheets'] as $stylesheet) {
- drupal_add_css($skin_path .'/'. $stylesheet);
- }
- }
-
- $hidden_elements = theme('views_slideshow_cycle_main_frame', $view, $rows, $vss_id, $options['mode']);
- $vars['slideshow'] = theme('views_slideshow_main_section', $vss_id, $hidden_elements, 'views_slideshow_cycle');
-
- $weight = array(
- 'top' => array(),
- 'bottom' => array(),
- );
- // Put our pager in the right location.
- $vars['pager_location'] = (isset($skin_info['pager_location'])) ? $skin_info['pager_location'] : $settings['pager'];
- $vars['pager'] = '';
- if ($vars['pager_location']) {
- $weight[$vars['pager_location']]['pager'] = (isset($skin_info['pager_weight'])) ? $skin_info['pager_weight'] : $settings['pager_weight'];
- }
-
- // Put our controls in the right location.
- // Only show controls when there is more than one result.
- $vars['controls_location'] = (isset($skin_info['controls_location'])) ? $skin_info['controls_location'] : $settings['controls'];
- $vars['controls_location'] = ($settings['num_divs'] > 1) ? $vars['controls_location'] : 0;
- $vars['controls'] = '';
- if ($vars['controls_location']) {
- $weight[$vars['controls_location']]['controls'] = (isset($skin_info['controls_weight'])) ? $skin_info['controls_weight'] : $settings['controls_weight'];
- }
-
- // Put our slide counter in the right location.
- $vars['slide_counter_location'] = (isset($skin_info['slide_counter_location'])) ? $skin_info['slide_counter_location'] : $settings['slide_counter'];
- $vars['slide_counter'] = '';
- if ($vars['slide_counter_location']) {
- $weight[$vars['slide_counter_location']]['slide_counter'] = (isset($skin_info['slide_counter_weight'])) ? $skin_info['slide_counter_weight'] : $settings['slide_counter_weight'];
- }
-
- // Build our widgets
- foreach ($weight as $location => $data) {
- // Build our top widgets
- if (!empty($data)) {
- asort($data);
-
- $vars[$location . '_widget_rendered'] = '';
- foreach ($data as $type => $order) {
- $vars[$type] = theme('views_slideshow_cycle_' . $type, $vss_id, $view, $options);
- $vars[$location . '_widget_rendered'] .= $vars[$type];
- }
- }
- }
-}
-
-/**
- * Views Slideshow: Theme the main frame wrapper.
- *
- * @ingroup themeable
- */
-
-function template_preprocess_views_slideshow_cycle_main_frame(&$vars) {
// Add the slideshow elements.
- $vars['attributes']['id'] = "views_slideshow_cycle_teaser_section_" . $vars['vss_id'];
+ $vars['attributes']['id'] = "views_slideshow_cycle_teaser_section_" . $vss_id;
$vars['attributes']['class'] = 'views_slideshow_cycle_teaser_section';
$styles = '';
- if (isset($vars['view']->display_handler->display->display_options['style_options']['views_slideshow_cycle'])) {
- $styles = $vars['view']->display_handler->display->display_options['style_options']['views_slideshow_cycle'];
+ 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($vars['view']->display['default']->display_options['style_options']['views_slideshow_cycle'])) {
- $styles_default = $vars['view']->display['default']->display_options['style_options']['views_slideshow_cycle'];
+ 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
@@ -188,10 +144,10 @@ function template_preprocess_views_slide
$items = array();
$slideshow_count = 0;
$rendered_rows = '';
- foreach ($vars['rows'] as $count => $item) {
+ 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', $items, $vars['vss_id'], $slideshow_count);
+ $rendered_rows .= theme('views_slideshow_cycle_main_frame_row', $items, $vss_id, $slideshow_count);
$items = array();
$slideshow_count++;
}