You are here

public function ConfigSettingsForm::submitForm in Drupal Commerce Connector for AvaTax 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 ConfigFormBase::submitForm

File

src/Form/ConfigSettingsForm.php, line 284

Class

ConfigSettingsForm
Configuration form for AvaTax settings.

Namespace

Drupal\commerce_avatax\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $address_validation = $form_state
    ->getValue('address_validation');
  $address_validation['countries'] = array_filter($address_validation['countries']);
  $this
    ->config('commerce_avatax.settings')
    ->set('api_mode', $form_state
    ->getValue('api_mode'))
    ->set('account_id', $form_state
    ->getValue('account_id'))
    ->set('company_code', $form_state
    ->getValue('company_code'))
    ->set('address_validation', $address_validation)
    ->set('customer_code_field', $form_state
    ->getValue('customer_code_field'))
    ->set('disable_commit', $form_state
    ->getValue('disable_commit'))
    ->set('disable_tax_calculation', $form_state
    ->getValue('disable_tax_calculation'))
    ->set('license_key', $form_state
    ->getValue('license_key'))
    ->set('logging', $form_state
    ->getValue('logging'))
    ->set('shipping_tax_code', $form_state
    ->getValue('shipping_tax_code'))
    ->save();
  parent::submitForm($form, $form_state);
}