Projet

Général

Profil

Révision 599a39cd

Ajouté par Assos Assos il y a environ 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_repeat/date_repeat_form.inc
1 1
<?php
2

  
2 3
/**
3 4
 * @file
4 5
 * Code to add a date repeat selection form to a date field and create
......
35 36
 * Generate the repeat setting form.
36 37
 */
37 38
function _date_repeat_rrule_process($element, &$form_state, $form) {
38

  
39
  // If the RRULE field is not visible to the user,
40
  // needs no processing or validation.
41
  // The Date field module is not adding this element to forms
42
  // if the field is hidden,
43
  // this test is just in case some other module attempts to do so.
44

  
39
  // If the RRULE field is not visible to the user, needs no processing or
40
  // validation. The Date field module is not adding this element to forms if
41
  // the field is hidden, this test is just in case some other module attempts
42
  // to do so.
45 43
  if (date_hidden_element($element)) {
46 44
    return $element;
47 45
  }
......
58 56
    $rrule = $element['#default_value'];
59 57
  }
60 58

  
61
  // Empty the original string value of the RRULE so we can create
62
  // an array of values for the form from the RRULE's contents.
59
  // Empty the original string value of the RRULE so we can create an array of
60
  // values for the form from the RRULE's contents.
63 61
  $element['#value'] = '';
64 62

  
65 63
  $parts = date_repeat_split_rrule($rrule);
......
554 552
  $parents = $element['#array_parents'];
555 553
  $instance = implode('-', $parents);
556 554

  
557
  // Make sure this will work right either in the normal
558
  // form or in an ajax callback from the 'Add more' button.
555
  // Make sure this will work right either in the normal form or in an AJAX
556
  // callback from the 'Add more' button.
559 557
  if (empty($form_state['num_exceptions'][$instance])) {
560 558
    $form_state['num_exceptions'][$instance] = count($exceptions);
561 559
  }
......
875 873
          }
876 874
        }
877 875
        break;
878

  
879
      default:
880
        break;
881 876
    }
882 877
  }
883 878

  
......
967 962
 * Build a RRULE out of the form values.
968 963
 */
969 964
function date_repeat_rrule_validate($element, &$form_state) {
970

  
971 965
  if (date_hidden_element($element)) {
972 966
    return;
973 967
  }
......
980 974
    return;
981 975
  }
982 976

  
983
  // Clean the buttons off of the form. Needed to avoid errors when
984
  // the date is used on a user object, which then passes the form
985
  // through form_state_values_clean().
977
  // Clean the buttons off of the form. Needed to avoid errors when the date is
978
  // used on a user object, which then passes the form through
979
  // form_state_values_clean().
986 980
  foreach ($form_state['buttons'] as $delta => $item) {
987 981
    if (!empty($item['#ajax']['callback']) && in_array($item['#ajax']['callback'], array('date_repeat_add_exception_callback', 'date_repeat_add_addition_callback'))) {
988 982
      unset($form_state['buttons'][$delta]);
......
1070 1064
/**
1071 1065
 * Helper function for transforming the return value of checkbox(es) element.
1072 1066
 *
1073
 * Can be used for transforming the returned value of checkbox(es) element
1074
 * to the format of returned value of multiple select element.
1067
 * Can be used for transforming the returned value of checkbox(es) element to
1068
 * the format of returned value of multiple select element.
1075 1069
 */
1076 1070
function date_repeat_transform_checkbox_values_to_select_values($values) {
1077 1071
  return array_filter($values, 'date_repeat_filter_non_zero_value');

Formats disponibles : Unified diff