protected function FastlySettingsForm::getServiceOptions in Fastly 8.3
Retrieves options for the Fastly service.
Return value
array Array of service ids mapped to service names.
1 call to FastlySettingsForm::getServiceOptions()
- FastlySettingsForm::buildForm in src/
Form/ FastlySettingsForm.php - Form constructor.
File
- src/
Form/ FastlySettingsForm.php, line 344
Class
- FastlySettingsForm
- Class FastlySettingsForm Defines a form to configure module settings.
Namespace
Drupal\fastly\FormCode
protected function getServiceOptions() {
if (empty($this->api
->getApiKey())) {
return [];
}
$services = $this->api
->getServices();
if (empty($services)) {
return [];
}
$service_options = [];
foreach ($services as $service) {
$service_options[$service->id] = $service->name;
}
ksort($service_options);
return $service_options;
}