function textimage_preset_edit_validate in Textimage 7.2
Same name and namespace in other branches
- 5.2 textimage_admin.inc \textimage_preset_edit_validate()
- 5 textimage.module \textimage_preset_edit_validate()
- 6.2 textimage_admin.inc \textimage_preset_edit_validate()
Todo.
File
- ./
textimage.admin.inc, line 448 - Textimage admin page callback
Code
function textimage_preset_edit_validate($form, &$form_state) {
// Check for illegal characters in preset names.
if (preg_match('/[^0-9a-zA-Z_]/', $form_state['values']['name'])) {
form_set_error('name', t('Please only use alphanumic characters and underscores (_) for preset names.'));
}
// Check for numbers at beginning of preset names.
if (preg_match('/^[0-9]/', $form_state['values']['name'])) {
form_set_error('name', t("Preset names can't begin with a number."));
}
// Check for duplicate preset names.
$preset = _textimage_preset_load($form_state['values']['name']);
if ($preset['name'] && (!isset($form_state['values']['pid']) || $form_state['values']['pid'] != $preset['pid'])) {
form_set_error('name', t('The name %name is already in use by another preset.', array(
'%name' => $form_state['values']['name'],
)));
}
}