You are here

public function CheckOutSettingsForm::submitForm in Basic cart 8

Same name and namespace in other branches
  1. 8.6 src/Form/CheckOutSettingsForm.php \Drupal\basic_cart\Form\CheckOutSettingsForm::submitForm()
  2. 8.0 src/Form/CheckOutSettingsForm.php \Drupal\basic_cart\Form\CheckOutSettingsForm::submitForm()
  3. 8.2 src/Form/CheckOutSettingsForm.php \Drupal\basic_cart\Form\CheckOutSettingsForm::submitForm()
  4. 8.3 src/Form/CheckOutSettingsForm.php \Drupal\basic_cart\Form\CheckOutSettingsForm::submitForm()
  5. 8.4 src/Form/CheckOutSettingsForm.php \Drupal\basic_cart\Form\CheckOutSettingsForm::submitForm()
  6. 8.5 src/Form/CheckOutSettingsForm.php \Drupal\basic_cart\Form\CheckOutSettingsForm::submitForm()

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

src/Form/CheckOutSettingsForm.php, line 120
Contains \Drupal\basic_cart\Form\CartSettingsForm

Class

CheckOutSettingsForm
Configure checkout settings for this site.

Namespace

Drupal\basic_cart\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $admin = array(
    "subject" => $form_state
      ->getValue('basic_cart_subject_admin'),
    "body" => $form_state
      ->getValue('basic_cart_administer_message'),
  );
  $user = array(
    "subject" => $form_state
      ->getValue('basic_cart_subject_user'),
    "body" => $form_state
      ->getValue('basic_cart_user_message'),
  );
  $thankyou = array(
    "title" => $form_state
      ->getValue('basic_cart_thankyou_page_title'),
    "text" => $form_state
      ->getValue('basic_cart_thankyou_page_text'),
    "custom_page" => $form_state
      ->getValue('basic_cart_thankyou_custom_page'),
  );
  $this
    ->config('basic_cart.checkout')
    ->set('admin_emails', $form_state
    ->getValue('basic_cart_administrator_emails'))
    ->set('admin', $admin)
    ->set('user', $user)
    ->set('send_emailto_user', $form_state
    ->getValue('basic_cart_send_emailto_user'))
    ->set('thankyou', $thankyou)
    ->save();
  parent::submitForm($form, $form_state);
}