You are here

private function SimpleLdapUserSettingsForm::getAttributeOptions in Simple LDAP 8

Parameters

array $object_classes: A list of LDAP objectClasses.

Return value

array A array of objectClass attributes formatted for use as options in a Form API element.

1 call to SimpleLdapUserSettingsForm::getAttributeOptions()
SimpleLdapUserSettingsForm::buildForm in modules/simple_ldap_user/src/Form/SimpleLdapUserSettingsForm.php
Form constructor.

File

modules/simple_ldap_user/src/Form/SimpleLdapUserSettingsForm.php, line 208

Class

SimpleLdapUserSettingsForm

Namespace

Drupal\simple_ldap_user\Form

Code

private function getAttributeOptions($object_classes) {
  $attributes = array();
  foreach ($object_classes as $object_class) {
    try {
      $result = $this->schema
        ->getAttributesByObjectClass($object_class);
      foreach ($result as $attribute) {
        $attributes[mb_strtolower($attribute)] = $attribute;
      }
    } catch (SimpleLdapException $e) {

      // Just absorb. No attributes are added to the list.
    }
  }
  asort($attributes);
  return $attributes;
}