public function CurrencyLocaleImportForm::submitForm in Currency 8.3
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ CurrencyLocaleImportForm.php, line 103
Class
- CurrencyLocaleImportForm
- Provides the currency locale import form.
Namespace
Drupal\currency\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$currency_locale = $this->configImporter
->importCurrencyLocale($form_state
->getValues()['locale']);
$this
->messenger()
->addMessage($this
->t('The %label has been imported.', [
'%label' => $currency_locale
->label(),
]));
if ($form_state
->getTriggeringElement()['#name'] == 'import_edit') {
$form_state
->setRedirectUrl($currency_locale
->toUrl('edit-form'));
}
else {
$form_state
->setRedirectUrl(new Url('entity.currency_locale.collection'));
}
}