function textimage_preset_edit_validate in Textimage 6.2
Same name and namespace in other branches
- 5.2 textimage_admin.inc \textimage_preset_edit_validate()
- 5 textimage.module \textimage_preset_edit_validate()
- 7.2 textimage.admin.inc \textimage_preset_edit_validate()
File
- ./
textimage_admin.inc, line 537
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, underscores (_), and hyphens (-) 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'],
)));
}
}