public function CurrencyLocaleImportForm::buildForm in Currency 8.3
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ CurrencyLocaleImportForm.php, line 66
Class
- CurrencyLocaleImportForm
- Provides the currency locale import form.
Namespace
Drupal\currency\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$currency_locales = $this->configImporter
->getImportableCurrencyLocales();
if (empty($currency_locales)) {
$form['message'] = [
'#markup' => $this
->t('All currency locales have been imported already.'),
];
}
else {
$form['locale'] = [
'#options' => $this->formHelper
->getCurrencyLocaleOptions($currency_locales),
'#required' => TRUE,
'#title' => $this
->t('Currency locale'),
'#type' => 'select',
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['import'] = [
'#dropbutton' => 'submit',
'#name' => 'import',
'#type' => 'submit',
'#value' => $this
->t('Import'),
];
$form['actions']['import_edit'] = [
'#dropbutton' => 'submit',
'#name' => 'import_edit',
'#type' => 'submit',
'#value' => $this
->t('Import and edit'),
];
}
return $form;
}