Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/webform_validation/webform_validation.module | ||
---|---|---|
5 | 5 |
* Add validation rules to webforms |
6 | 6 |
*/ |
7 | 7 |
|
8 |
include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'webform_validation') . '/' . 'webform_validation.validators.inc';
|
|
9 |
include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'webform_validation') . '/' . 'webform_validation.rules.inc';
|
|
8 |
include_once('webform_validation.validators.inc');
|
|
9 |
include_once('webform_validation.rules.inc');
|
|
10 | 10 |
|
11 | 11 |
/** |
12 | 12 |
* Implements hook_menu(). |
... | ... | |
153 | 153 |
} |
154 | 154 |
|
155 | 155 |
if ($rules) { |
156 |
$component_definitions = webform_validation_prefix_keys($node->webform['components']); |
|
157 |
// Remove hidden components. |
|
158 |
foreach ($component_definitions as $key => $component) { |
|
159 |
if (_webform_client_form_rule_check($node, $component, 0, $form_state['values']['submitted']) !== WEBFORM_CONDITIONAL_INCLUDE) { |
|
160 |
unset($flat_values[$key]); |
|
161 |
} |
|
162 |
} |
|
156 | 163 |
foreach ($rules as $rule) { |
157 | 164 |
// create a list of components that need validation against this rule (component id => user submitted value) |
158 | 165 |
$items = array(); |
... | ... | |
163 | 170 |
} |
164 | 171 |
// prefix array keys to avoid reindexing by the module_invoke_all function call |
165 | 172 |
$items = webform_validation_prefix_keys($items); |
166 |
$component_definitions = webform_validation_prefix_keys($node->webform['components']); |
|
167 | 173 |
$rule['sid'] = $sid; |
168 | 174 |
// have the submitted values validated |
169 | 175 |
$errors = module_invoke_all("webform_validation_validate", $rule['validator'], $items, $component_definitions, $rule); |
... | ... | |
302 | 308 |
*/ |
303 | 309 |
function webform_validation_webform_validation($type, $op, $data) { |
304 | 310 |
if ($type == 'rule' && in_array($op, array('add', 'edit'))) { |
305 |
if (module_exists('i18n') && isset($data['error_message'])) { |
|
311 |
if (module_exists('i18n_string') && isset($data['error_message'])) {
|
|
306 | 312 |
i18n_string_update('webform_validation:error_message:' . $data['ruleid'] . ':message', $data['error_message']); |
307 | 313 |
} |
308 | 314 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules