function library_admin_action_validate in Library 7
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()
- 6 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 360 - 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')) {
$row_number = db_query("SELECT aid FROM {library_actions} WHERE aid <> :aid AND name = :name", array(
':aid' => $form_state['values']['aid'],
':name' => $form_state['values']['name'],
))
->rowCount();
if ($row_number > 0) {
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')) {
$row_number = db_query("SELECT aid FROM {library_actions} WHERE name = :name", array(
':name' => $form_state['values']['name'],
))
->rowCount();
if ($row_number > 0) {
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.'));
}
}