You are here

function path_breadcrumbs_edit_form_validate in Path Breadcrumbs 7

Validate callback for path_breadcrumbs_form.

File

./path_breadcrumbs.module, line 184

Code

function path_breadcrumbs_edit_form_validate($form, &$form_state) {

  // Check whether path exists.
  if (!isset($form_state['values']['path_breadcrumbs'])) {
    $path = $form_state['values']['path'];
    $path_exists = db_select('path_breadcrumbs', 'p')
      ->fields('p', array(
      'path_id',
    ))
      ->condition('p.path', trim($path))
      ->execute()
      ->fetchField();
    if ($path_exists) {
      form_set_error('path', t('This path is already using.'));
    }
  }
}