Révision 6a93dd76
Ajouté par Assos Assos il y a environ 8 ans
drupal7/sites/all/modules/webform/includes/webform.components.inc | ||
---|---|---|
428 | 428 |
$form['form_key'] = array( |
429 | 429 |
'#type' => 'textfield', |
430 | 430 |
'#default_value' => empty($component['form_key']) ? _webform_safe_name($component['name']) : $component['form_key'], |
431 |
'#title' => t('Field Key'),
|
|
431 |
'#title' => t('Form Key'),
|
|
432 | 432 |
'#description' => t('Enter a machine readable key for this form element. May contain only alphanumeric characters and underscores. This key will be used as the name attribute of the form element. This value has no effect on the way data is saved, but may be helpful if doing custom form processing.'), |
433 | 433 |
'#required' => TRUE, |
434 | 434 |
'#weight' => -9, |
... | ... | |
638 | 638 |
$node = $form['#node'];; |
639 | 639 |
|
640 | 640 |
if (!preg_match('/^[a-z0-9_]+$/i', $form_state['values']['form_key'])) { |
641 |
form_set_error('form_key', t('The field key %field_key is invalid. Please include only lowercase alphanumeric characters and underscores.', array('%field_key' => $form_state['values']['form_key'])));
|
|
641 |
form_set_error('form_key', t('The form key %form_key is invalid. Please include only lowercase alphanumeric characters and underscores.', array('%form_key' => $form_state['values']['form_key'])));
|
|
642 | 642 |
} |
643 | 643 |
|
644 | 644 |
foreach ($node->webform['components'] as $cid => $component) { |
645 | 645 |
if (($component['cid'] != $form_state['values']['cid'] || $form_state['values']['clone']) && ($component['pid'] == $form_state['values']['pid']) && (strcasecmp($component['form_key'], $form_state['values']['form_key']) == 0)) { |
646 |
form_set_error('form_key', t('The field key %field_key is already in use by the field labeled %existing_field. Please use a unique key.', array('%field_key' => $form_state['values']['form_key'], '%existing_field' => $component['name'])));
|
|
646 |
form_set_error('form_key', t('The form key %form_key is already in use by the field labeled %existing_field. Please use a unique key.', array('%form_key' => $form_state['values']['form_key'], '%existing_field' => $component['name'])));
|
|
647 | 647 |
} |
648 | 648 |
} |
649 | 649 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules