You are here

public function CommerceCurrencyResolverSelectForm::submitForm in Commerce Currency Resolver 8

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/CommerceCurrencyResolverSelectForm.php, line 112

Class

CommerceCurrencyResolverSelectForm
Class CommerceCurrencyResolverSelectForm.

Namespace

Drupal\commerce_currency_resolver\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Get form value.
  $selected_currency = $form_state
    ->getValue('currency');

  // Set cookie for one day.
  setrawcookie($this->currencyHelper
    ->getCookieName(), rawurlencode($selected_currency), $this->time
    ->getRequestTime() + 86400, '/');
}