protected function SetupForm::buildChooseForm in Acquia Connector 8
Same name and namespace in other branches
- 8.2 src/Form/SetupForm.php \Drupal\acquia_connector\Form\SetupForm::buildChooseForm()
- 3.x src/Form/SetupForm.php \Drupal\acquia_connector\Form\SetupForm::buildChooseForm()
Build choose form.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: Form state.
Return value
array Form.
1 call to SetupForm::buildChooseForm()
- SetupForm::buildForm in src/
Form/ SetupForm.php - Form constructor.
File
- src/
Form/ SetupForm.php, line 130
Class
- SetupForm
- Acquia Connector setup form.
Namespace
Drupal\acquia_connector\FormCode
protected function buildChooseForm(FormStateInterface &$form_state) {
$options = [];
$storage = $form_state
->getStorage();
foreach ($storage['response']['subscription'] as $credentials) {
$options[] = $credentials['name'];
}
asort($options);
$form = [
'#prefix' => $this
->t('You have multiple subscriptions available.'),
'subscription' => [
'#type' => 'select',
'#title' => $this
->t('Available subscriptions'),
'#options' => $options,
'#description' => $this
->t('Choose from your available subscriptions.'),
'#required' => TRUE,
],
'continue' => [
'#type' => 'submit',
'#value' => $this
->t('Submit'),
],
];
return $form;
}