Révision d0ed0aa6
Ajouté par Assos Assos il y a presque 4 ans
drupal7/sites/all/modules/webform_validation/webform_validation.admin.inc | ||
---|---|---|
12 | 12 |
* rule. |
13 | 13 |
*/ |
14 | 14 |
function webform_validation_manage($node) { |
15 |
$rules = webform_validation_get_webform_rules($node);
|
|
15 |
$rules = webform_validation_get_node_rules($node->nid);
|
|
16 | 16 |
$output = array(); |
17 | 17 |
$output['webform_validation_manage_overview_form'] = drupal_get_form('webform_validation_manage_overview_form', $rules, $node); |
18 | 18 |
$output['webform_validation_manage_add_rule'] = array( |
... | ... | |
24 | 24 |
|
25 | 25 |
/** |
26 | 26 |
* Get the list of rules associated with the webform. |
27 |
* |
|
28 |
* @deprecated in webform_validation:7.x-1.18 and is removed from webform_validation:7.x-2.0. Use webform_validation_get_node_rules(). |
|
29 |
* @see https://www.drupal.org/project/webform_validation/issues/3104316 |
|
27 | 30 |
*/ |
28 | 31 |
function webform_validation_get_webform_rules($node) { |
29 | 32 |
if (in_array($node->type, webform_variable_get('webform_node_types'))) { |
30 |
$webform_nid = $node->nid; |
|
31 |
$rules = webform_validation_get_node_rules($node->nid); |
|
33 |
return webform_validation_get_node_rules($node->nid); |
|
32 | 34 |
} |
33 |
return $rules; |
|
34 | 35 |
} |
35 | 36 |
|
36 | 37 |
/** |
... | ... | |
249 | 250 |
'#required' => (bool) $required, |
250 | 251 |
'#size' => 60, |
251 | 252 |
'#maxlength' => NULL, |
252 |
'#default_value' => $rule['data'],
|
|
253 |
'#default_value' => isset($rule['data']) ? $rule['data'] : NULL,
|
|
253 | 254 |
'#weight' => 4, |
254 | 255 |
); |
255 | 256 |
} |
... | ... | |
259 | 260 |
'#type' => 'checkbox', |
260 | 261 |
'#title' => t('Negate rule'), |
261 | 262 |
'#description' => t('Validate the inverse of the rule.'), |
262 |
'#default_value' => $rule['negate'],
|
|
263 |
'#default_value' => isset($rule['negate']) ? $rule['negate'] : NULL,
|
|
263 | 264 |
'#weight' => 5, |
264 | 265 |
); |
265 | 266 |
} |
... | ... | |
272 | 273 |
'#required' => TRUE, |
273 | 274 |
'#size' => 60, |
274 | 275 |
'#maxlength' => 2048, |
275 |
'#default_value' => $rule['error_message'],
|
|
276 |
'#default_value' => isset($rule['error_message']) ? $rule['error_message'] : NULL,
|
|
276 | 277 |
'#weight' => 5, |
277 | 278 |
); |
278 | 279 |
} |
... | ... | |
306 | 307 |
$rule_validator = webform_validation_get_validator_info($values['validator']); |
307 | 308 |
|
308 | 309 |
// Validate custom data. |
309 |
if ($values['data'] && !empty($rule_validator['custom_data']['validate_regex']) && !preg_match($rule_validator['custom_data']['validate_regex'], $values['data'])) {
|
|
310 |
if (!empty($values['data']) && !empty($rule_validator['custom_data']['validate_regex']) && !preg_match($rule_validator['custom_data']['validate_regex'], $values['data'])) {
|
|
310 | 311 |
form_set_error('data', $rule_validator['custom_data']['label'] . ' ' . t('is invalid.')); |
311 | 312 |
} |
312 | 313 |
|
... | ... | |
367 | 368 |
); |
368 | 369 |
} |
369 | 370 |
|
370 |
return confirm_form($form, t('Are you sure you want to delete the rule %name?', array('%name' => $rule['rulename'])), isset($_GET['destination']) ? $_GET['destination'] : $_GET['q'], t('This action cannot be undone.'), t('Delete'), t('Cancel') |
|
371 |
); |
|
371 |
return confirm_form( |
|
372 |
$form, |
|
373 |
t('Are you sure you want to delete the rule %name?', array('%name' => $rule['rulename'])), |
|
374 |
'node/' . $rule['nid'] . '/webform/validation', |
|
375 |
NULL, |
|
376 |
t('Delete')); |
|
372 | 377 |
} |
373 | 378 |
|
374 | 379 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules