| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @file 5 * Contains the list style plugin. 6 */ 7 8 /** 9 * Style plugin to render each item in a slideshow of an ordered or unordered list. 10 * 11 * @ingroup views_style_plugins 12 */ 13 class views_slideshow_plugin_style_slideshow extends views_plugin_style_list { 14 // if the view is still using the old variables replace with the new ones. 15 function init(&$view, &$display, $options = NULL) { 16 // These are required for the view to continue to work. 17 $this->view = &$view; 18 $this->display = &$display; 19 20 // Overlay incoming options on top of defaults 21 $this->unpack_options($this->options, isset($options) ? $options : $display->handler->get_option('style_options')); 22 23 if ($this->uses_row_plugin() && $display->handler->get_option('row_plugin')) { 24 $this->row_plugin = $display->handler->get_plugin('row'); 25 } 26 27 // Eveything below here is what's needed for views slideshow. 28 if (in_array($options['mode'], array('singleframe', 'thumbnailhover', 'menu', 'slider', 'ddblock')) && is_array($options[$options['mode']])) { 29 foreach ($options[$options['mode']] as $index => $value) { 30 $this->options['views_slideshow_' . $options['mode']][$index] = $value; 31 } 32 } 33 } 34 35 // Set default options 36 function option_definition() { 37 module_load_all_includes('views_slideshow.inc'); 38 $options = parent::option_definition(); 39 40 $options = array_merge($options, module_invoke_all('views_slideshow_option_definition')); 41 $options['mode'] = array('default' => ''); 42 43 return $options; 44 } 45 46 // Render the given style. 47 function options_form(&$form, &$form_state) { 48 module_load_all_includes('views_slideshow.inc'); 49 parent::options_form($form, $form_state); 50 51 $modules = module_invoke_all('views_slideshow_modes'); 52 53 if ($modules) { 54 $form['mode'] = array( 55 '#type' => 'select', 56 '#title' => t('Slideshow mode'), 57 '#options' => $modules, 58 '#default_value' => $this->options['mode'], 59 ); 60 foreach (module_implements('views_slideshow_options_form') as $module) { 61 // We wrap our fieldsets in a div so we can use dependent.js to 62 // show/hide our fieldsets. 63 $form[$module . '-prefix'] = array( 64 '#type' => 'hidden', 65 '#id' => $module . '-options-wrapper', 66 '#prefix' => '<div><div id="' . $module .'-options-wrapper">', 67 '#process' => array('views_process_dependency'), 68 '#dependency' => array('edit-style-options-mode' => array($module)), 69 ); 70 71 $form[$module] = array( 72 '#type' => 'fieldset', 73 '#title' => t( $modules[$module] . ' options'), 74 '#collapsible' => TRUE, 75 '#attributes' => array('class' => $module), 76 ); 77 $function = $module .'_views_slideshow_options_form'; 78 call_user_func_array($function, array(&$form, &$form_state, &$this)); 79 80 $form[$module . '-suffix'] = array( 81 '#value' => '</div></div>', 82 ); 83 } 84 } 85 else { 86 $form['enable_module'] = array( 87 '#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'))), 88 ); 89 } 90 } 91 92 function options_validate(&$form, &$form_state) { 93 module_load_all_includes('views_slideshow.inc'); 94 foreach (module_implements('views_slideshow_options_form_validate') as $module) { 95 $function = $module . '_views_slideshow_options_form_validate'; 96 call_user_func_array($function, array(&$form, &$form_state, &$this)); 97 } 98 } 99 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |