function ds_preprocess_field_form_validate in Display Suite 6.3
Same name and namespace in other branches
- 6 includes/ds.fields.inc \ds_preprocess_field_form_validate()
- 6.2 includes/ds.fields.inc \ds_preprocess_field_form_validate()
- 7.2 modules/ds_ui/includes/ds.fields.inc \ds_preprocess_field_form_validate()
- 7 ds.fields.inc \ds_preprocess_field_form_validate()
Validate preprocess field submission, only on insert.
File
- includes/
ds.fields.inc, line 445 - Manage fields.
Code
function ds_preprocess_field_form_validate($form, &$form_state) {
if ($form['#form_type'] == 'insert') {
$module = $form['#module'];
$fields = $form['#all_fields'];
$existing = array_keys($fields);
if (in_array($form_state['values']['preprocess_key'], $existing)) {
form_set_error('preprocess_key', t('This field already exists.'));
}
if (!preg_match('!^[a-z_0-9]+$!', $form_state['values']['preprocess_key'])) {
form_set_error('preprocess_key', t('The machine-readable name must contain only lowercase letters, numbers and underscores.'));
}
}
}