Mercurial > hg > rr-repo
comparison sites/all/modules/flexslider/flexslider.admin.inc @ 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 * @file | |
4 * Administrative page callbacks for the flexslider module. | |
5 */ | |
6 | |
7 /** | |
8 * Submit handler for adding a new option set. | |
9 */ | |
10 function flexslider_form_optionset_add_submit($form, &$form_state) { | |
11 $optionset = flexslider_optionset_create(array('name' => $form_state['values']['name'], 'title' => $form_state['values']['title'])); | |
12 | |
13 $saved = flexslider_optionset_save($optionset, TRUE); | |
14 | |
15 if ($saved) { | |
16 drupal_set_message(t('Option set %name was created.', array('%name' => $optionset->name))); | |
17 $form_state['redirect'] = 'admin/config/media/flexslider/edit/' . $optionset->name; | |
18 } | |
19 else { | |
20 drupal_set_message(t('Failed to create option set. Please verify your settings.'), 'error'); | |
21 } | |
22 } | |
23 | |
24 /** | |
25 * Defines the form elements used to edit the FlexSlider library options | |
26 * | |
27 * @param array $options [optional] | |
28 * Pass in a set of default values for the options | |
29 * @return array | |
30 * Returns the option set array | |
31 */ | |
32 function flexslider_option_elements($options = array()) { | |
33 $form = array(); | |
34 | |
35 // General Slideshow and Animiation Settings | |
36 $form['animation_slideshow'] = array( | |
37 '#type' => 'fieldset', | |
38 '#title' => t('General Slideshow and Animation Settings'), | |
39 ); | |
40 | |
41 $form['animation_slideshow']['animation'] = array( | |
42 '#type' => 'select', | |
43 '#title' => t('Animation'), | |
44 '#description' => t('Select your animation type'), | |
45 '#options' => array( | |
46 'fade' => t('Fade'), | |
47 'slide' => t('Slide'), | |
48 ), | |
49 '#default_value' => isset($options['animation']) ? $options['animation'] : _flexslider_optionset_defaults('animation'), | |
50 // @todo add states to enable/disable the direction | |
51 ); | |
52 | |
53 $form['animation_slideshow']['animationSpeed'] = array( | |
54 '#type' => 'textfield', | |
55 '#title' => t('Animation Speed'), | |
56 '#description' => t('Set the speed of animations, in milliseconds'), | |
57 '#element_validate' => array('_flexslider_validate_positive_integer'), | |
58 '#default_value' => isset($options['animationSpeed']) ? $options['animationSpeed'] : _flexslider_optionset_defaults('animationSpeed'), | |
59 '#size' => 30, | |
60 ); | |
61 | |
62 $form['animation_slideshow']['direction'] = array( | |
63 '#type' => 'select', | |
64 '#title' => t('Slide Direction'), | |
65 '#description' => t('Select the sliding direction, "horizontal" or "vertical"'), | |
66 '#options' => array( | |
67 'horizontal' => t('Horizontal'), | |
68 'vertical' => t('Vertical'), | |
69 ), | |
70 '#default_value' => isset($options['direction']) ? $options['direction'] : _flexslider_optionset_defaults('direction'), | |
71 ); | |
72 | |
73 $form['animation_slideshow']['slideshow'] = array( | |
74 '#type' => 'checkbox', | |
75 '#title' => t('Slideshow'), | |
76 '#description' => t('Animate the slides automatically'), | |
77 '#default_value' => isset($options['slideshow']) ? $options['slideshow'] : _flexslider_optionset_defaults('slideshow'), | |
78 ); | |
79 | |
80 // Build in support for easing plugin | |
81 $easing_options = array('swing' => t('Swing'), 'linear' => t('Linear')); | |
82 if (module_exists('jqeasing')) { | |
83 $easing_options = array_merge($easing_options, _flexslider_jqeasing_options()); | |
84 | |
85 } | |
86 | |
87 $form['animation_slideshow']['easing'] = array( | |
88 '#type' => 'select', | |
89 '#title' => t('Easing'), | |
90 '#multiple' => FALSE, | |
91 '#description' => t('The description appears usually below the item.'), | |
92 '#options' => $easing_options, | |
93 '#default_value' => isset($options['easing']) ? $options['easing'] : _flexslider_optionset_defaults('easing'), | |
94 ); | |
95 | |
96 $form['animation_slideshow']['smoothHeight'] = array( | |
97 '#type' => 'checkbox', | |
98 '#title' => t('Smooth Height'), | |
99 '#description' => t('Animate the height of the slider smoothly for slides of varying height.'), | |
100 '#default_value' => isset($options['smoothHeight']) ? $options['smoothHeight'] : _flexslider_optionset_defaults('smoothHeight'), | |
101 ); | |
102 | |
103 $form['animation_slideshow']['reverse'] = array( | |
104 '#type' => 'checkbox', | |
105 '#title' => t('Reverse'), | |
106 '#description' => t('Animate the slides in reverse'), | |
107 '#default_value' => isset($options['reverse']) ? $options['reverse'] : _flexslider_optionset_defaults('reverse'), | |
108 ); | |
109 | |
110 $form['animation_slideshow']['slideshowSpeed'] = array( | |
111 '#type' => 'textfield', | |
112 '#title' => t('Slideshow speed'), | |
113 '#description' => t('Set the speed of the slideshow cycling, in milliseconds'), | |
114 '#element_validate' => array('_flexslider_validate_positive_integer'), | |
115 '#default_value' => isset($options['slideshowSpeed']) ? $options['slideshowSpeed'] : _flexslider_optionset_defaults('slideshowSpeed'), | |
116 '#size' => 30, | |
117 ); | |
118 | |
119 $form['animation_slideshow']['animationLoop'] = array( | |
120 '#type' => 'checkbox', | |
121 '#title' => t('Loop Slideshow'), | |
122 '#description' => t('Loop the slideshow once it reaches the last slide.'), | |
123 '#default_value' => isset($options['animationLoop']) ? $options['animationLoop'] : _flexslider_optionset_defaults('animationLoop'), | |
124 ); | |
125 | |
126 $form['animation_slideshow']['randomize'] = array( | |
127 '#type' => 'checkbox', | |
128 '#title' => t('Randomize Slide Order'), | |
129 '#description' => t('Randomize the order the slides play back.'), | |
130 '#default_value' => isset($options['randomize']) ? $options['randomize'] : _flexslider_optionset_defaults('randomize'), | |
131 ); | |
132 $form['animation_slideshow']['startAt'] = array( | |
133 '#type' => 'textfield', | |
134 '#title' => t('Starting Slide'), | |
135 '#description' => t('The slide that the slider should start on. Ex: For the first slide enter "0", for the second enter "1", etc. If you enter a value which is greater than the number of slides, the slider will default to the first slide.'), | |
136 '#element_validate' => array('_flexslider_validate_positive_integer'), | |
137 '#default_value' => isset($options['startAt']) ? $options['startAt'] : _flexslider_optionset_defaults('startAt'), | |
138 '#size' => 30, | |
139 // @todo add states to disable if randomize is set | |
140 ); | |
141 | |
142 $form['animation_slideshow']['itemWidth'] = array( | |
143 '#type' => 'textfield', | |
144 '#title' => t('Item Width'), | |
145 '#description' => t('Box-model width of individual carousel items, including horizontal borders and padding.'), | |
146 '#size' => 40, | |
147 '#maxlength' => 255, | |
148 '#default_value' => isset($options['itemWidth']) ? $options['itemWidth'] : _flexslider_optionset_defaults('itemWidth'), | |
149 ); | |
150 $form['animation_slideshow']['itemMargin'] = array( | |
151 '#type' => 'textfield', | |
152 '#title' => t('Item Margin'), | |
153 '#description' => t('Margin between carousel items. (NB: the margin must be set in your CSS styles. This property merely informs FlexSlider of the margin.)'), | |
154 '#size' => 40, | |
155 '#maxlength' => 255, | |
156 '#default_value' => isset($options['itemMargin']) ? $options['itemMargin'] : _flexslider_optionset_defaults('itemMargin'), | |
157 ); | |
158 $form['animation_slideshow']['minItems'] = array( | |
159 '#type' => 'textfield', | |
160 '#title' => t('Minimum Items'), | |
161 '#description' => t('Minimum number of carousel items that should be visible.'), | |
162 '#size' => 40, | |
163 '#maxlength' => 255, | |
164 '#default_value' => isset($options['minItems']) ? $options['minItems'] : _flexslider_optionset_defaults('minItems'), | |
165 ); | |
166 $form['animation_slideshow']['maxItems'] = array( | |
167 '#type' => 'textfield', | |
168 '#title' => t('Max Items'), | |
169 '#description' => t('Maximum number of carousel items that should be visible.'), | |
170 '#size' => 40, | |
171 '#maxlength' => 255, | |
172 '#default_value' => isset($options['maxItems']) ? $options['maxItems'] : _flexslider_optionset_defaults('maxItems'), | |
173 ); | |
174 $form['animation_slideshow']['move'] = array( | |
175 '#type' => 'textfield', | |
176 '#title' => t('Move'), | |
177 '#description' => t('Number of carousel items that should move on animation. If 0, slider will move all visible items.'), | |
178 '#size' => 40, | |
179 '#maxlength' => 255, | |
180 '#default_value' => isset($options['move']) ? $options['move'] : _flexslider_optionset_defaults('move'), | |
181 ); | |
182 | |
183 // Navigation and Control Settings | |
184 $form['nav_controls'] = array( | |
185 '#type' => 'fieldset', | |
186 '#title' => t('Navigation and Control Settings'), | |
187 ); | |
188 $form['nav_controls']['directionNav'] = array( | |
189 '#type' => 'checkbox', | |
190 '#title' => t('Next/Previous Controls'), | |
191 '#description' => t('Add controls for previous/next navigation'), | |
192 '#default_value' => isset($options['directionNav']) ? $options['directionNav'] : _flexslider_optionset_defaults('directionNav'), | |
193 ); | |
194 $form['nav_controls']['controlNav'] = array( | |
195 '#type' => 'select', | |
196 '#title' => t('Paging Controls'), | |
197 '#description' => t('Add controls to jump to individual slides. (Note: set to "On" if using Manual Controls)'), | |
198 '#default_value' => isset($options['controlNav']) ? $options['controlNav'] : _flexslider_optionset_defaults('controlNav'), | |
199 '#options' => array( | |
200 0 => t('Off'), | |
201 1 => t('On'), | |
202 'thumbnails' => t('Thumbnails'), | |
203 ) | |
204 ); | |
205 $form['nav_controls']['keyboard'] = array( | |
206 '#type' => 'checkbox', | |
207 '#title' => t('Keyboard Navigation'), | |
208 '#description' => t('Allow slider navigating via keyboard left/right keys'), | |
209 '#default_value' => isset($options['keyboard']) ? $options['keyboard'] : _flexslider_optionset_defaults('keyboard'), | |
210 ); | |
211 $form['nav_controls']['multipleKeyboard'] = array( | |
212 '#type' => 'checkbox', | |
213 '#title' => t('Multiple Keyboard'), | |
214 '#description' => t('Allow keyboard navigation to affect multiple sliders.'), | |
215 '#default_value' => isset($options['multipleKeyboard']) ? $options['multipleKeyboard'] : _flexslider_optionset_defaults('multipleKeyboard'), | |
216 ); | |
217 $form['nav_controls']['mousewheel'] = array( | |
218 '#type' => 'checkbox', | |
219 '#title' => t('Mousewheel Navigation'), | |
220 '#description' => t('Allow slider navigating via mousewheel'), | |
221 '#default_value' => isset($options['mousewheel']) ? $options['mousewheel'] : _flexslider_optionset_defaults('mousewheel'), | |
222 // @todo add check for jquery mousewheel library | |
223 ); | |
224 $form['nav_controls']['touch'] = array( | |
225 '#type' => 'checkbox', | |
226 '#title' => t('Touch'), | |
227 '#description' => t('Allow touch swipe navigation.'), | |
228 '#default_value' => isset($options['touch']) ? $options['touch'] : _flexslider_optionset_defaults('touch'), | |
229 ); | |
230 $form['nav_controls']['prevText'] = array( | |
231 '#type' => 'textfield', | |
232 '#title' => t('Previous Link Text'), | |
233 '#description' => t('Set the text for the "previous" control item. <em>Text translation can be controlled using the <a href="http://drupal.org/project/stringoverrides">String Overrides module</a>.</em>'), | |
234 '#default_value' => isset($options['prevText']) ? $options['prevText'] : _flexslider_optionset_defaults('prevText'), | |
235 ); | |
236 $form['nav_controls']['nextText'] = array( | |
237 '#type' => 'textfield', | |
238 '#title' => t('Next Link Text'), | |
239 '#description' => t('Set the text for the "next" control item. <em>Text translation can be controlled using the <a href="http://drupal.org/project/stringoverrides">String Overrides module</a>.</em>'), | |
240 '#default_value' => isset($options['nextText']) ? $options['nextText'] : _flexslider_optionset_defaults('nextText'), | |
241 ); | |
242 | |
243 // Advanced Options | |
244 $form['advanced'] = array( | |
245 '#type' => 'fieldset', | |
246 '#title' => t('Advanced Options'), | |
247 ); | |
248 $form['advanced']['namespace'] = array( | |
249 '#type' => 'textfield', | |
250 '#title' => t('Namespace'), | |
251 '#description' => t('Prefix string attached to the classes of all elements generated by the plugin.'), | |
252 '#size' => 40, | |
253 '#maxlength' => 255, | |
254 '#element_validate' => array('_flexslider_validate_namespace'), | |
255 '#default_value' => isset($options['namespace']) ? $options['namespace'] : _flexslider_optionset_defaults('namespace'), | |
256 ); | |
257 $form['advanced']['selector'] = array( | |
258 '#type' => 'textfield', | |
259 '#title' => t('Selector'), | |
260 '#description' => t('Must match a simple pattern. "{container} > {slide}".'), | |
261 '#size' => 40, | |
262 '#maxlength' => 255, | |
263 '#element_validate' => array('_flexslider_validate_selector'), | |
264 '#default_value' => isset($options['selector']) ? $options['selector'] : _flexslider_optionset_defaults('selector'), | |
265 ); | |
266 $form['advanced']['sync'] = array( | |
267 '#type' => 'textfield', | |
268 '#title' => t('Sync'), | |
269 '#description' => t('Mirror the actions performed on this slider with another slider.'), | |
270 '#size' => 40, | |
271 '#maxlength' => 255, | |
272 '#default_value' => isset($options['sync']) ? $options['sync'] : _flexslider_optionset_defaults('sync'), | |
273 ); | |
274 $form['advanced']['asNavFor'] = array( | |
275 '#type' => 'textfield', | |
276 '#title' => t('Use as navigation'), | |
277 '#description' => t('Turn the slider into a thumbnail navigation for another slider.'), | |
278 '#size' => 40, | |
279 '#maxlength' => 255, | |
280 '#default_value' => isset($options['asNavFor']) ? $options['asNavFor'] : _flexslider_optionset_defaults('asNavFor'), | |
281 ); | |
282 | |
283 $form['advanced']['initDelay'] = array( | |
284 '#type' => 'textfield', | |
285 '#title' => t('Initialize Delay'), | |
286 '#description' => t('Set an initialization delay, in milliseconds.'), | |
287 '#size' => 20, | |
288 '#maxlength' => 255, | |
289 '#default_value' => isset($options['initDelay']) ? $options['initDelay'] : _flexslider_optionset_defaults('initDelay'), | |
290 //'#element_validate' => add validate on zero or greater integer | |
291 ); | |
292 $form['advanced']['useCSS'] = array( | |
293 '#type' => 'checkbox', | |
294 '#title' => t('Use CSS'), | |
295 '#description' => t('Slider will use CSS3 transitions, if available.'), | |
296 '#default_value' => isset($options['useCSS']) ? $options['useCSS'] : _flexslider_optionset_defaults('useCSS'), | |
297 ); | |
298 $form['advanced']['video'] = array( | |
299 '#type' => 'checkbox', | |
300 '#title' => t('Video'), | |
301 '#description' => t('Will prevent use of CSS3 3D Transforms, avoiding graphical glitches.'), | |
302 '#default_value' => isset($options['video']) ? $options['video'] : _flexslider_optionset_defaults('video'), | |
303 ); | |
304 $form['advanced']['pausePlay'] = array( | |
305 '#type' => 'checkbox', | |
306 '#title' => t('Add Pause/Play Indicator'), | |
307 '#description' => t('Have FlexSlider add an element indicating the current state of the slideshow (i.e. "pause" or "play").'), | |
308 '#default_value' => isset($options['pausePlay']) ? $options['pausePlay'] : _flexslider_optionset_defaults('pausePlay'), | |
309 // @todo add states value for pause/play text | |
310 ); | |
311 $form['advanced']['pauseText'] = array( | |
312 '#type' => 'textfield', | |
313 '#title' => t('Pause State Text'), | |
314 '#description' => t('Set the text for the "pause" state indicator. <em>Text translation can be controlled using the <a href="http://drupal.org/project/stringoverrides">String Overrides module</a>.</em>'), | |
315 '#default_value' => isset($options['pauseText']) ? $options['pauseText'] : _flexslider_optionset_defaults('pauseText'), | |
316 ); | |
317 $form['advanced']['playText'] = array( | |
318 '#type' => 'textfield', | |
319 '#title' => t('Play State Text'), | |
320 '#description' => t('Set the text for the "play" state indicator. <em>Text translation can be controlled using the <a href="http://drupal.org/project/stringoverrides">String Overrides module</a>.</em>'), | |
321 '#default_value' => isset($options['playText']) ? $options['playText'] : _flexslider_optionset_defaults('playText'), | |
322 ); | |
323 $form['advanced']['pauseOnAction'] = array( | |
324 '#type' => 'checkbox', | |
325 '#title' => t('Pause On Controls'), | |
326 '#description' => t('Pause the slideshow when interacting with control elements.'), | |
327 '#default_value' => isset($options['pauseOnAction']) ? $options['pauseOnAction'] : _flexslider_optionset_defaults('pauseOnAction'), | |
328 ); | |
329 $form['advanced']['pauseOnHover'] = array( | |
330 '#type' => 'checkbox', | |
331 '#title' => t('Pause On Hover'), | |
332 '#description' => t('Pause the slideshow when hovering over slider, then resume when no longer hovering.'), | |
333 '#default_value' => isset($options['pauseOnHover']) ? $options['pauseOnHover'] : _flexslider_optionset_defaults('pauseOnHover'), | |
334 ); | |
335 $form['advanced']['controlsContainer'] = array( | |
336 '#type' => 'textfield', | |
337 '#title' => t('Controls container (Advanced)'), | |
338 '#description' => t('Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken.'), | |
339 '#default_value' => isset($options['controlsContainer']) ? $options['controlsContainer'] : _flexslider_optionset_defaults('controlsContainer'), | |
340 ); | |
341 $form['advanced']['manualControls'] = array( | |
342 '#type' => 'textfield', | |
343 '#title' => t('Manual controls (Advanced)'), | |
344 '#description' => t('Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.'), | |
345 '#default_value' => isset($options['manualControls']) ? $options['manualControls'] : _flexslider_optionset_defaults('manualControls'), | |
346 ); | |
347 | |
348 return $form; | |
349 } | |
350 | |
351 /** | |
352 * Form builder; Form to edit a given option set. | |
353 */ | |
354 function flexslider_form_optionset_edit($form, &$form_state) { | |
355 | |
356 if (empty($form_state['optionset'])) { | |
357 $optionset = flexslider_optionset_create(); | |
358 } | |
359 else { | |
360 $optionset = $form_state['optionset']; | |
361 } | |
362 | |
363 // Title | |
364 $form['title'] = array( | |
365 '#type' => 'textfield', | |
366 '#maxlength' => '255', | |
367 '#title' => t('Title'), | |
368 '#description' => t('A human-readable title for this option set.'), | |
369 '#required' => TRUE, | |
370 '#default_value' => $optionset->title, | |
371 ); | |
372 $form['name'] = array( | |
373 '#type' => 'machine_name', | |
374 '#maxlength' => '255', | |
375 '#machine_name' => array( | |
376 'source' => array('title'), | |
377 'exists' => 'flexslider_optionset_exists', | |
378 ), | |
379 '#required' => TRUE, | |
380 '#default_value' => $optionset->name, | |
381 ); | |
382 | |
383 // Show select boxes for the various image styles (thumbnail, normal, big) | |
384 $image_style = image_style_options(FALSE); | |
385 $form['image_style'] = array( | |
386 '#type' => 'fieldset', | |
387 '#title' => 'Image style', | |
388 '#tree' => TRUE, | |
389 ); | |
390 $form['image_style']['normal'] = array( | |
391 '#type' => 'select', | |
392 '#title' => t('Normal image style'), | |
393 '#description' => t('Image style for the main stage images.'), | |
394 '#empty_option' => t('None (original image)'), | |
395 '#options' => $image_style, | |
396 '#default_value' => $optionset->imagestyle_normal, | |
397 ); | |
398 $form['image_style']['thumbnail'] = array( | |
399 '#type' => 'select', | |
400 '#title' => t('Thumbnail image style'), | |
401 '#description' => t('Image style for the thumbnail images.'), | |
402 '#empty_option' => t('None (original image)'), | |
403 '#options' => $image_style, | |
404 '#default_value' => $optionset->imagestyle_thumbnail, | |
405 // @todo enable/disable this option based on the type of options selected | |
406 // Ex: Thumbnails should be enabled | |
407 ); | |
408 | |
409 // Options Vertical Tab Group table | |
410 $form['options'] = array( | |
411 '#type' => 'vertical_tabs', | |
412 ); | |
413 | |
414 $default_options = flexslider_option_elements($optionset->options); | |
415 // Add the options to the vertical tabs section | |
416 foreach ($default_options as $key => $value) { | |
417 $form['options'][] = $value; | |
418 } | |
419 | |
420 return $form; | |
421 } | |
422 | |
423 /** | |
424 * Validate a form element that should have an integer value. | |
425 */ | |
426 function _flexslider_validate_positive_integer($element, &$form_state) { | |
427 $value = $element['#value']; | |
428 if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value < 0)) { | |
429 form_error($element, t('%name must be a positive integer.', array('%name' => $element['#title']))); | |
430 } | |
431 } | |
432 | |
433 /** | |
434 * Validate a form element that should have a number as value. | |
435 */ | |
436 function _flexslider_validate_number($element, &$form_state) { | |
437 $value = $element['#value']; | |
438 if ($value !== '' && !is_numeric($value)) { | |
439 form_error($element, t('%name must be a number.', array('%name' => $element['#option_name']))); | |
440 } | |
441 } | |
442 | |
443 /** | |
444 * Form builder; Form to delete a given option set. | |
445 */ | |
446 function flexslider_optionset_form_delete($form, &$form_state, $optionset) { | |
447 $form_state['optionset'] = &$optionset; | |
448 | |
449 // Deleting an export in code will revert it. | |
450 $op = ($optionset->export_type & EXPORT_IN_CODE) ? 'Revert' : 'Delete'; | |
451 | |
452 return confirm_form( | |
453 $form, | |
454 t('Are you sure you want to @action the option set %name?', array('@action' => t(drupal_strtolower($op)), '%name' => $optionset->name)), | |
455 'admin/config/media/flexslider', | |
456 NULL, | |
457 t($op), t('Cancel') | |
458 ); | |
459 } | |
460 | |
461 /** | |
462 * Submit handler for deleting an option set. | |
463 */ | |
464 function flexslider_optionset_form_delete_submit($form, &$form_state) { | |
465 $optionset = &$form_state['optionset']; | |
466 $op = ($optionset->export_type & EXPORT_IN_CODE) ? 'reverted' : 'deleted'; | |
467 | |
468 ctools_include('export'); | |
469 ctools_export_crud_delete('flexslider_optionset', $optionset); | |
470 | |
471 drupal_set_message(t('Option set %name was ' . $op . '.', array('%name' => $optionset->name))); | |
472 $form_state['redirect'] = 'admin/config/media/flexslider'; | |
473 } | |
474 | |
475 | |
476 /** | |
477 * Form builder; Form for advanced module settings. | |
478 */ | |
479 function flexslider_form_settings() { | |
480 $form = array(); | |
481 | |
482 $form['library'] = array( | |
483 '#type' => 'fieldset', | |
484 '#title' => 'Library', | |
485 ); | |
486 | |
487 // Debug mode toggle | |
488 $form['library']['flexslider_debug'] = array( | |
489 '#type' => 'checkbox', | |
490 '#title' => t('Enable debug mode'), | |
491 '#description' => t('Load the human-readable version of the FlexSlider library.'), | |
492 '#default_value' => variable_get('flexslider_debug', FALSE), | |
493 '#access' => user_access('administer flexslider'), | |
494 ); | |
495 | |
496 return system_settings_form($form); | |
497 } | |
498 | |
499 /** | |
500 * Submit handler for the advanced module settings. | |
501 */ | |
502 function flexslider_form_settings_submit($form, &$form_state) { | |
503 // Do nothing for now | |
504 } | |
505 | |
506 /** | |
507 * Validation functions | |
508 */ | |
509 function _flexslider_validate_namespace($element, &$form_state) { | |
510 // @todo | |
511 // @see form_error() | |
512 return TRUE; | |
513 } | |
514 | |
515 function _flexslider_validate_selector($element, &$form_state) { | |
516 // @todo | |
517 // @see form_error() | |
518 return TRUE; | |
519 } |