comparison sites/all/modules/views_slideshow/views_slideshow.api.php @ 2:b74b41bb73f0

-- Google analytics module
author danieleb <danielebarchiesi@me.com>
date Thu, 22 Aug 2013 17:22:54 +0100
parents
children
comparison
equal deleted inserted replaced
1:67ce89da90df 2:b74b41bb73f0
1 <?php
2
3 /**
4 * @file
5 * Hooks provided by Views Slideshow.
6 */
7
8 /**
9 * @addtogroup hooks
10 * @{
11 */
12
13 /**
14 * Define the type of the slideshow (eg.: cycle, imageflow, ddblock).
15 *
16 * @return
17 * Associative array of slideshow type and its information.
18 */
19 function hook_views_slideshow_slideshow_info() {
20 $options = array(
21 'views_slideshow_cycle' => array(
22 'name' => t('Cycle'),
23 'accepts' => array(
24 'goToSlide',
25 'nextSlide',
26 'pause',
27 'play',
28 'previousSlide',
29 ),
30 'calls' => array(
31 'transitionBegin',
32 'transitionEnd',
33 'goToSlide',
34 'pause',
35 'play',
36 'nextSlide',
37 'previousSlide',
38 ),
39 ),
40 );
41 return $options;
42 }
43
44 /**
45 * Define form fields to be displayed in the views settings form.
46 * These fields would help configure your slideshow type.
47 */
48 function hook_views_slideshow_slideshow_type_form(&$form, &$form_state, &$view) {
49 $form['views_slideshow_cycle']['effect'] = array(
50 '#type' => 'select',
51 '#title' => t('Effect'),
52 '#options' => $effects,
53 '#default_value' => $view->options['views_slideshow_cycle']['effect'],
54 '#description' => t('The transition effect that will be used to change between images. Not all options below may be relevant depending on the effect. ' . l('Follow this link to see examples of each effect.', 'http://jquery.malsup.com/cycle/browser.html', array('attributes' => array('target' => '_blank')))),
55 );
56 }
57
58 /**
59 * Set default values for your form fields specified in hook_views_slideshow_type_form
60 *
61 * @return
62 * Associative array of slideshow type name and options.
63 */
64 function hook_views_slideshow_option_definition() {
65 $options['views_slideshow_cycle'] = array(
66 'contains' => array(
67 // Transition
68 'effect' => array('default' => 'fade'),
69 'transition_advanced' => array('default' => 0),
70 'timeout' => array('default' => 5000),
71 'speed' => array('default' => 700), //normal
72 'delay' => array('default' => 0),
73 'sync' => array('default' => 1),
74 'random' => array('default' => 0),
75 )
76 );
77 return $options;
78 }
79
80 /**
81 * Form validation callback for the slideshow settings.
82 */
83 function hook_views_slideshow_options_form_validate(&$form, &$form_state, &$view) {
84 if (!is_numeric($form_state['values']['style_options']['views_slideshow_cycle']['speed'])) {
85 form_error($form['views_slideshow_cycle']['speed'], t('!setting must be numeric!', array('Speed')));
86 }
87 if (!is_numeric($form_state['values']['style_options']['views_slideshow_cycle']['timeout'])) {
88 form_error($form['views_slideshow_cycle']['speed'], t('!setting must be numeric!', array('timeout')));
89 }
90 if (!is_numeric($form_state['values']['style_options']['views_slideshow_cycle']['remember_slide_days'])) {
91 form_error($form['views_slideshow_cycle']['remember_slide_days'], t('!setting must be numeric!', array('Slide days')));
92 }
93 }
94
95 /**
96 * Form submission callback for the slideshow settings.
97 */
98 function hook_views_slideshow_options_form_submit($form, &$form_state) {
99 // Act on option submission.
100 }
101
102 /**
103 * Define slideshow skins to be available to the end user.
104 */
105 function hook_views_slideshow_skin_info() {
106 return array(
107 'default' => array(
108 'name' => t('Default'),
109 ),
110 );
111 }
112
113 /**
114 * Define new widgets (pagers, controls, counters).
115 *
116 * Available events for accepts and calls
117 * - pause
118 * - play
119 * - nextSlide
120 * - previousSlide
121 * - goToSlide
122 * - transitionBegin
123 * - transitionEnd
124 *
125 * @return
126 * Array keyed by the widget names.
127 */
128 function hook_views_slideshow_widget_info() {
129 return array(
130 'views_slideshow_pager' => array(
131 'name' => t('Pager'),
132 'accepts' => array(
133 'transitionBegin' => array('required' => TRUE),
134 'goToSlide',
135 'previousSlide',
136 'nextSlide',
137 ),
138 'calls' => array(
139 'goToSlide',
140 'pause',
141 'play',
142 ),
143 ),
144 'views_slideshow_controls' => array(
145 'name' => t('Controls'),
146 'accepts' => array(
147 'pause' => array('required' => TRUE),
148 'play' => array('required' => TRUE),
149 ),
150 'calls' => array(
151 'nextSlide',
152 'pause',
153 'play',
154 'previousSlide',
155 ),
156 ),
157 'views_slideshow_slide_counter' => array(
158 'name' => t('Slide Counter'),
159 'accepts' => array(
160 'transitionBegin' => array('required' => TRUE),
161 'goToSlide',
162 'previousSlide',
163 'nextSlide',
164 ),
165 'calls' => array(),
166 ),
167 );
168 }
169
170 /**
171 * Form fields to be added for a specific widget type. Example of a widget type would be views_slideshow_pager or views_slideshow_slide_counter.
172 */
173 function INSERT_WIDGET_TYPE_HERE_views_slideshow_widget_form_options(&$form, $form_state, $view, $defaults, $dependency) {
174 }
175
176 /**
177 * Hook called by the pager widget to configure it, the fields that should be shown.
178 */
179 function hook_views_slideshow_widget_pager_info($view) {
180 }
181
182 /**
183 * Hook called by the pager widget to add form items.
184 */
185 function INSERT_WIDGET_TYPE_HERE_views_slideshow_widget_pager_form_options(&$form, &$form_state, &$view, $defaults, $dependency) {
186 }
187
188 /**
189 * Hook called by the controls widget to configure it, the fields that should be shown.
190 */
191 function hook_views_slideshow_widget_controls_info($view) {
192 }
193
194 /**
195 * Hook called by the controls widget to add form items.
196 */
197 function INSERT_WIDGET_TYPE_HERE_views_slideshow_widget_controls_form_options(&$form, &$form_state, &$view, $defaults, $dependency) {
198 }
199
200 /**
201 * @} End of "addtogroup hooks".
202 */