function homebox_admin_page_validate in Homebox 6
Same name and namespace in other branches
- 6.3 homebox.admin.inc \homebox_admin_page_validate()
- 6.2 homebox.admin.inc \homebox_admin_page_validate()
- 7.3 homebox.admin.inc \homebox_admin_page_validate()
- 7.2 homebox.admin.inc \homebox_admin_page_validate()
1 string reference to 'homebox_admin_page_validate'
- homebox_admin_page in ./
homebox.admin.inc - @file Home box admin file, takes care admin interface for homebox
File
- ./
homebox.admin.inc, line 115 - Home box admin file, takes care admin interface for homebox
Code
function homebox_admin_page_validate($form, &$form_state) {
if ($form_state['values']['name']) {
if ($form_state['values']['op'] == t('Save page')) {
if (db_result(db_query("SELECT COUNT(*) FROM {homebox_pages} WHERE name = '%s' AND pid <> %d", $form_state['values']['name'], $form_state['values']['pid']))) {
form_set_error('name', t('The page name %name already exists. Please choose another page name.', array(
'%name' => $form_state['values']['name'],
)));
}
}
else {
if ($form_state['values']['op'] == t('Add page')) {
if (db_result(db_query("SELECT COUNT(*) FROM {homebox_pages} WHERE name = '%s'", $form_state['values']['name']))) {
form_set_error('name', t('The page name %name already exists. Please choose another page name.', array(
'%name' => $form_state['values']['name'],
)));
}
}
}
}
else {
form_set_error('name', t('You must specify a valid page name.'));
}
}