Projet

Général

Profil

Révision cee0424c

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

-a

Voir les différences:

drupal7/modules/simpletest/tests/file_test.module
76 76
  );
77 77

  
78 78
  $form['allow_all_extensions'] = array(
79
    '#type' => 'checkbox',
80
    '#title' => t('Allow all extensions?'),
81
    '#default_value' => FALSE,
79
    '#type' => 'radios',
80
    '#options' => array(
81
      'false' => 'No',
82
      'empty_array' => 'Empty array',
83
      'empty_string' => 'Empty string',
84
    ),
85
    '#default_value' => 'false',
82 86
  );
83 87

  
84 88
  $form['is_image_file'] = array(
......
114 118
    $validators['file_validate_is_image'] = array();
115 119
  }
116 120

  
117
  if ($form_state['values']['allow_all_extensions']) {
121
  $allow = $form_state['values']['allow_all_extensions'];
122
  if ($allow === 'empty_array') {
118 123
    $validators['file_validate_extensions'] = array();
119 124
  }
125
  elseif ($allow === 'empty_string') {
126
    $validators['file_validate_extensions'] = array('');
127
  }
120 128
  elseif (!empty($form_state['values']['extensions'])) {
121 129
    $validators['file_validate_extensions'] = array($form_state['values']['extensions']);
122 130
  }

Formats disponibles : Unified diff