diff --git a/currency/src/Controller/CurrencyImportForm.php b/currency/src/Controller/CurrencyImportForm.php index 68ead96..a743fe3 100644 --- a/currency/src/Controller/CurrencyImportForm.php +++ b/currency/src/Controller/CurrencyImportForm.php @@ -9,6 +9,7 @@ namespace Drupal\currency\Controller; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Form\FormBase; +use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\Url; use Drupal\currency\ConfigImporterInterface; @@ -67,7 +68,7 @@ class CurrencyImportForm extends FormBase implements ContainerInjectionInterface /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state) { + public function buildForm(array $form, FormStateInterface $form_state) { $currencies = $this->configImporter->getImportableCurrencies(); if (empty($currencies)) { $form['message'] = array( @@ -104,17 +105,17 @@ class CurrencyImportForm extends FormBase implements ContainerInjectionInterface /** * {@inheritdoc} */ - public function submitForm(array &$form, array &$form_state) { - $currency = $this->configImporter->importCurrency($form_state['values']['currency_code']); + public function submitForm(array &$form, FormStateInterface $form_state) { + $currency = $this->configImporter->importCurrency($form_state->getValues()['currency_code']); drupal_set_message($this->t('The %label has been imported.', array( '%label' => $currency->label(), ))); - if ($form_state['triggering_element']['#name'] == 'import_edit') { - $form_state['redirect_route'] = $currency->urlInfo('edit-form'); + if ($form_state->getTriggeringElement()['#name'] == 'import_edit') { + $form_state->setRedirectUrl($currency->urlInfo('edit-form')); } else { - $form_state['redirect_route'] = new Url('currency.currency.list'); + $form_state->setRedirectUrl(new Url('currency.currency.list')); } } diff --git a/currency/src/Controller/CurrencyLocaleImportForm.php b/currency/src/Controller/CurrencyLocaleImportForm.php index 64aa58a..be58d27 100644 --- a/currency/src/Controller/CurrencyLocaleImportForm.php +++ b/currency/src/Controller/CurrencyLocaleImportForm.php @@ -9,6 +9,7 @@ namespace Drupal\currency\Controller; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Form\FormBase; +use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\Url; use Drupal\currency\ConfigImporterInterface; @@ -67,7 +68,7 @@ class CurrencyLocaleImportForm extends FormBase implements ContainerInjectionInt /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state) { + public function buildForm(array $form, FormStateInterface $form_state) { $currency_locales = $this->configImporter->getImportableCurrencyLocales(); if (empty($currency_locales)) { $form['message'] = array( @@ -104,17 +105,17 @@ class CurrencyLocaleImportForm extends FormBase implements ContainerInjectionInt /** * {@inheritdoc} */ - public function submitForm(array &$form, array &$form_state) { - $currency_locale = $this->configImporter->importCurrencyLocale($form_state['values']['locale']); + public function submitForm(array &$form, FormStateInterface $form_state) { + $currency_locale = $this->configImporter->importCurrencyLocale($form_state->getValues()['locale']); drupal_set_message($this->t('The %label has been imported.', array( '%label' => $currency_locale->label(), ))); - if ($form_state['triggering_element']['#name'] == 'import_edit') { - $form_state['redirect_route'] = $currency_locale->urlInfo('edit-form'); + if ($form_state->getTriggeringElement()['#name'] == 'import_edit') { + $form_state->setRedirectUrl($currency_locale->urlInfo('edit-form')); } else { - $form_state['redirect_route'] = new Url('currency.currency_locale.list'); + $form_state->setRedirectUrl(new Url('currency.currency_locale.list')); } }