function protected_pages_configure_validate in Protected Pages 7
Same name and namespace in other branches
- 7.2 protected_pages.admin.inc \protected_pages_configure_validate()
Implements hook_validate().
File
- ./
protected_pages.admin.inc, line 113 - Provides page callbacks for configuration page.
Code
function protected_pages_configure_validate($form, &$form_state) {
$form_state['values']['path'] = drupal_get_normal_path($form_state['values']['path']);
if (!drupal_valid_path($form_state['values']['path'])) {
form_set_error('path', t('Please enter a correct path!'));
}
$pid = db_select('protected_pages')
->fields('protected_pages', array(
'pid',
))
->condition('path', $form_state['values']['path'])
->range(0, 1)
->execute()
->fetchField();
if ($pid) {
form_set_error('path', t('Duplicate path entry is not allowed. There is already a path or its alias exists.'));
}
}