public function ZoneSelectionForm::buildZoneListing in CloudFlare 8
Builds a form render array for zone selection.
Return value
array Form Api Render array for zone select.
1 call to ZoneSelectionForm::buildZoneListing()
- ZoneSelectionForm::buildZoneSelectSection in src/
Form/ ZoneSelectionForm.php - Builds zone selection section for inclusion in the settings form.
File
- src/
Form/ ZoneSelectionForm.php, line 192
Class
- ZoneSelectionForm
- Class ZoneSelectionForm.
Namespace
Drupal\cloudflare\FormCode
public function buildZoneListing() {
$form_select_field = [];
$zone_select = [];
foreach ($this->zones as $zone) {
$zone_select[$zone
->getZoneId()] = $zone
->getName();
}
$form_select_field = [
'#type' => 'textfield',
'#title' => $this
->t('Zone'),
'#disabled' => FALSE,
'#options' => $zone_select,
'#description' => $this
->t('Use the autocomplete to select your zone (top level domain for the site). The zone ID corresponding to the domain will then be saved in the field.'),
'#default_value' => $this->config
->get('zone_id'),
'#empty_option' => '- None -',
'#empty_value' => '0',
'#autocomplete_route_name' => 'cloudflare.zone_autocomplete',
];
return $form_select_field;
}