function protected_pages_edit_validate in Protected Pages 7.2
Same name and namespace in other branches
- 7 protected_pages.admin.inc \protected_pages_edit_validate()
Implements hook_validate().
File
- ./
protected_pages.admin.inc, line 208 - Provides page callbacks for configuration page.
Code
function protected_pages_edit_validate($form, &$form_state) {
$form_state['normal_path'] = drupal_get_normal_path($form_state['values']['path']);
if (!drupal_valid_path($form_state['normal_path'])) {
form_set_error('path', t('Please enter a correct path!'));
}
$pid = db_select('protected_pages')
->fields('protected_pages', array(
'pid',
))
->condition(db_or()
->condition('path', $form_state['normal_path'])
->condition('path', $form_state['values']['path']))
->condition('pid', $form_state['values']['pid'], '<>')
->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.'));
}
}