You are here

public function ApiKeyForm::getUser in Services API Key Authentication 8

Same name and namespace in other branches
  1. 8.2 src/Form/ApiKeyForm.php \Drupal\services_api_key_auth\Form\ApiKeyForm::getUser()
  2. 3.0.x src/Form/ApiKeyForm.php \Drupal\services_api_key_auth\Form\ApiKeyForm::getUser()
  3. 2.0.x src/Form/ApiKeyForm.php \Drupal\services_api_key_auth\Form\ApiKeyForm::getUser()

Helper function to get taxonomy term options for select widget.

@parameter String $machine_name taxonomy machine name

Return value

array Select options for form

1 call to ApiKeyForm::getUser()
ApiKeyForm::form in src/Form/ApiKeyForm.php
Gets the actual form array to be built.

File

src/Form/ApiKeyForm.php, line 96

Class

ApiKeyForm
Class ApiKeyForm.

Namespace

Drupal\services_api_key_auth\Form

Code

public function getUser() {
  $options = array();

  // $vid = taxonomy_vocabulary_machine_name_load($machine_name)->vid;
  $options_source = \Drupal::entityTypeManager()
    ->getStorage('user')
    ->loadMultiple();
  foreach ($options_source as $item) {
    $key = $item->uuid->value;
    $value = $item->name->value;
    $options[$key] = $value;
  }
  return $options;
}