You are here

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

Same name and namespace in other branches
  1. 8.4 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 93

Class

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

Namespace

Drupal\ldap_query\Controller

Code

public function availableFields() {
  $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) {
    if (is_array($result)) {
      foreach ($result as $k => $v) {
        if (is_numeric($k)) {
          $attributes[$v] = $v;
        }
      }
    }
  }
  return $attributes;
}