You are here

public function QueryController::availableFields in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_query/src/Controller/QueryController.php \Drupal\ldap_query\Controller\QueryController::availableFields()

Return available fields.

Return value

array Available fields.

File

ldap_query/src/Controller/QueryController.php, line 173

Class

QueryController
Controller class for LDAP queries, in assistance to the entity itself.

Namespace

Drupal\ldap_query\Controller

Code

public function availableFields() : array {
  $attributes = [];

  // We loop through all results since some users might not have fields set
  // for them and those are missing and not null.
  foreach ($this->results as $result) {
    foreach ($result
      ->getAttributes() as $field_name => $field_value) {
      $attributes[$field_name] = $field_name;
    }
  }
  return $attributes;
}