You are here

public function LdapAuthorizationConsumerConfAdmin::drupalFormValidate in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php \LdapAuthorizationConsumerConfAdmin::drupalFormValidate()
  2. 7 ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php \LdapAuthorizationConsumerConfAdmin::drupalFormValidate()

File

ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php, line 313

Class

LdapAuthorizationConsumerConfAdmin
LDAP Authorization Consumer Configration Admin Class.

Code

public function drupalFormValidate($op, $values) {
  $errors = [];
  if ($op == 'delete') {
    if (!$this->consumerType) {
      $errors['consumer_type_missing'] = 'Consumer type is missing from delete form.';
    }
  }
  else {
    $this
      ->populateFromDrupalForm($op, $values);
    $errors = $this
      ->validate($values);
    if (count($this->mappings) == 0 && trim($values['mappings'])) {
      $errors['mappings'] = t('Bad mapping syntax.  Text entered but not able to convert to array.');
    }
  }
  return $errors;
}