function _content_admin_field_add_new_validate in Content Construction Kit (CCK) 5
Same name and namespace in other branches
- 6 includes/content.admin.inc \_content_admin_field_add_new_validate()
Field name validation for programmatic field addition that supply the field name.
File
- ./
content_admin.inc, line 612 - Administrative interface for content type creation.
Code
function _content_admin_field_add_new_validate($form_id, $form_values) {
if ($form_values['field_name']) {
$fields = content_fields();
if (!empty($fields[$form_values['field_name']])) {
form_set_error('field_name', t('The field name %field_name already exists.', array(
'%field_name' => $form_values['field_name'],
)));
}
if (!preg_match('!^[a-z0-9_]+$!', $form_values['field_name'])) {
form_set_error('field_name', t('The field name %field_name is invalid.', array(
'%field_name' => $form_values['field_name'],
)));
}
}
}