Projet

Général

Profil

Révision a60304ed

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/flexslider/flexslider.admin.inc
81 81
  $easing_options = array('swing' => t('Swing'), 'linear' => t('Linear'));
82 82
  if (module_exists('jqeasing')) {
83 83
    $easing_options = array_merge($easing_options, _flexslider_jqeasing_options());
84
    
84

  
85 85
  }
86 86

  
87 87
  $form['animation_slideshow']['easing'] = array(
......
212 212
        ':input[name="controlNav"]' => array('value' => 'thumbnails'),
213 213
      ),
214 214
    ),
215
    '#element_validate' => array('_flexslider_validate_minimum_version_22'),
215
    '#element_validate' => array('_flexslider_validate_minimum_version_22', '_flexslider_validate_thumb_caption'),
216 216
  );
217 217
  $form['nav_controls']['thumbCaptionsBoth'] = array(
218 218
    '#type' => 'checkbox',
......
224 224
        ':input[name="controlNav"]' => array('value' => 'thumbnails'),
225 225
      ),
226 226
    ),
227
    '#element_validate' => array('_flexslider_validate_minimum_version_22'),
227
    '#element_validate' => array('_flexslider_validate_minimum_version_22', '_flexslider_validate_thumb_caption'),
228 228
  );
229 229
  $form['nav_controls']['keyboard'] = array(
230 230
    '#type' => 'checkbox',
......
404 404
    '#default_value' => $optionset->name,
405 405
  );
406 406

  
407
  if ($optionset->name) {
408
    $form['name']['#disabled'] = TRUE;
409
  }
410

  
407 411
  // Options Vertical Tab Group table
408 412
  $form['options'] = array(
409 413
    '#type' => 'vertical_tabs',
......
411 415

  
412 416
  $default_options = flexslider_option_elements($optionset->options);
413 417
  // Add the options to the vertical tabs section
414
  foreach ($default_options as $key => $value) {
418
  foreach ($default_options as $value) {
415 419
    $form['options'][] = $value;
416 420
  }
417 421

  
......
463 467
  $optionset = &$form_state['optionset'];
464 468
  $op = ($optionset->export_type & EXPORT_IN_CODE) ? 'reverted' : 'deleted';
465 469

  
466
  ctools_include('export');
467
  ctools_export_crud_delete('flexslider_optionset', $optionset);
470
  flexslider_optionset_delete($optionset);
468 471

  
469 472
  drupal_set_message(t('Option set %name was ' . $op . '.', array('%name' => $optionset->name)));
470 473
  $form_state['redirect'] = 'admin/config/media/flexslider';
......
517 520
}
518 521

  
519 522
/**
520
 * Validate a form element that should have a number as value.
523
 * Validate the minimum library version.
521 524
 */
522 525
function _flexslider_validate_minimum_version_22($element, &$form_state) {
523 526
  $lib = libraries_detect('flexslider');
......
528 531
    $version = $lib['version'];
529 532
    $required = "2.2";
530 533

  
531
    if (!version_compare($version, $required, '>=')) {
534
    if ($element['#value'] && !version_compare($version, $required, '>=')) {
532 535
      form_error($element, t('To use %name you must install FlexSlider version !required or higher.', array(
533 536
        '%name' => $element['#title'],
534 537
        '!required' => l($required, 'https://github.com/woothemes/FlexSlider/tree/version/2.2'),
......
536 539
    }
537 540
  }
538 541
}
542

  
543
/**
544
 * Validate the thumb caption options.
545
 *
546
 * Empties the value of the thumbnail caption option when the paging control
547
 * is not set to thumbnails.
548
 *
549
 * @param array $element
550
 * @param array$form_state
551
 */
552
function _flexslider_validate_thumb_caption($element, &$form_state) {
553
  if ($form_state['values']['controlNav'] !== 'thumbnails' && $element['#value']) {
554
    form_set_value($element, '', $form_state);
555
  }
556
}

Formats disponibles : Unified diff