public function ApiKeyForm::getUser in Services API Key Authentication 3.0.x
Same name and namespace in other branches
- 8.2 src/Form/ApiKeyForm.php \Drupal\services_api_key_auth\Form\ApiKeyForm::getUser()
- 8 src/Form/ApiKeyForm.php \Drupal\services_api_key_auth\Form\ApiKeyForm::getUser()
- 2.0.x src/Form/ApiKeyForm.php \Drupal\services_api_key_auth\Form\ApiKeyForm::getUser()
Helper function to get user entity options for select widget.
@parameter String $machine_name user name
Return value
array Select options for form
File
- src/
Form/ ApiKeyForm.php, line 124
Class
- ApiKeyForm
- Class ApiKeyForm.
Namespace
Drupal\services_api_key_auth\FormCode
public function getUser() {
$options = [];
$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;
}