You are here

public function CheckoutSettingsForm::submitForm in Ubercart 8.4

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 ConfigFormBase::submitForm

File

uc_cart/src/Form/CheckoutSettingsForm.php, line 277

Class

CheckoutSettingsForm
Configure general checkout settings for this site.

Namespace

Drupal\uc_cart\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $cart_config = $this
    ->config('uc_cart.settings');
  $cart_config
    ->set('checkout_enabled', $form_state
    ->getValue('uc_checkout_enabled'));

  // @todo Uncomment this conditional when Rules actually works.
  // if (!$this->moduleHandler->moduleExists('rules')) {
  $cart_config
    ->set('checkout_email_customer', $form_state
    ->getValue('uc_checkout_email_customer'))
    ->set('checkout_email_admin', $form_state
    ->getValue('uc_checkout_email_admin'));

  //}
  $cart_config
    ->set('checkout_anonymous', $form_state
    ->getValue('uc_checkout_anonymous'))
    ->set('mail_existing', $form_state
    ->getValue('uc_cart_mail_existing'))
    ->set('email_validation', $form_state
    ->getValue('uc_cart_email_validation'))
    ->set('new_account_name', $form_state
    ->getValue('uc_cart_new_account_name'))
    ->set('new_account_password', $form_state
    ->getValue('uc_cart_new_account_password'))
    ->set('new_customer_email', $form_state
    ->getValue('uc_new_customer_email'))
    ->set('new_customer_login', $form_state
    ->getValue('uc_new_customer_login'))
    ->set('new_customer_status_active', $form_state
    ->getValue('uc_new_customer_status_active'))
    ->set('panes', $form_state
    ->getValue('panes'))
    ->save();
  $this
    ->config('uc_cart.messages')
    ->set('logged_in', $form_state
    ->getValue('uc_msg_order_logged_in'))
    ->set('existing_user', $form_state
    ->getValue('uc_msg_order_existing_user'))
    ->set('new_user', $form_state
    ->getValue('uc_msg_order_new_user'))
    ->set('new_user_logged_in', $form_state
    ->getValue('uc_msg_order_new_user_logged_in'))
    ->save();
  parent::submitForm($form, $form_state);
}