function library_admin_action_validate in Library 6
Same name and namespace in other branches
- 5.2 library.admin.inc \library_admin_action_validate()
- 6.2 library.admin.inc \library_admin_action_validate()
- 7 library.admin.inc \library_admin_action_validate()
Menu callback: Edit Library Action.
See also
theme_library_admin_new_action()
1 string reference to 'library_admin_action_validate'
- library_admin_action in ./
library.admin.inc - Menu callback: Edit Library Action.
File
- ./
library.admin.inc, line 317 - Administrative settings for the library module
Code
function library_admin_action_validate($form, &$form_state) {
if ($form_state['values']['name']) {
if ($form_state['values']['op'] == t('Save action')) {
if (db_result(db_query("SELECT COUNT(*) FROM {library_actions} WHERE name = '%s' AND aid <> %d", $form_state['values']['name'], $form_state['values']['aid']))) {
form_set_error('name', t('The action name %name already exists. Please choose another action name.', array(
'%name' => $form_state['values']['name'],
)));
}
}
elseif ($form_state['values']['op'] == t('Add action')) {
if (db_result(db_query("SELECT COUNT(*) FROM {library_actions} WHERE name = '%s'", $form_state['values']['name']))) {
form_set_error('name', t('The action name %name already exists. Please choose another action name.', array(
'%name' => $form_state['values']['name'],
)));
}
}
}
else {
form_set_error('name', t('You must specify a valid action name.'));
}
}