You are here

protected function LdapQueryAdmin::validate in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_query/LdapQueryAdmin.class.php \LdapQueryAdmin::validate()
  2. 7 ldap_query/LdapQueryAdmin.class.php \LdapQueryAdmin::validate()
1 call to LdapQueryAdmin::validate()
LdapQueryAdmin::drupalFormValidate in ldap_query/LdapQueryAdmin.class.php

File

ldap_query/LdapQueryAdmin.class.php, line 276

Class

LdapQueryAdmin

Code

protected function validate($op) {
  $errors = [];
  if ($op == 'add') {
    $ldap_queries = $this
      ->getLdapQueryObjects('all', 'all');
    if (count($ldap_queries)) {
      foreach ($ldap_queries as $qid => $ldap_query) {
        if ($this->qid == $ldap_query->qid) {
          $errors['qid'] = t('An LDAP Query with the name %qid already exists.', [
            '%qid' => $this->qid,
          ]);
        }
      }
    }
  }
  return $errors;
}