You are here

public function USPSSettingsForm::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

shipping/uc_usps/src/Form/USPSSettingsForm.php, line 246

Class

USPSSettingsForm
Configures USPS settings.

Namespace

Drupal\uc_usps\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $usps_config = $this
    ->config('uc_usps.settings');
  $values = $form_state
    ->getValues();
  $usps_config
    ->set('user_id', $values['user_id'])
    ->set('online_rates', $values['online_rates'])
    ->set('env_services', $values['env_services'])
    ->set('services', $values['services'])
    ->set('intl_env_services', $values['intl_env_services'])
    ->set('intl_services', $values['intl_services'])
    ->set('rate_markup_type', $values['rate_markup_type'])
    ->set('rate_markup', $values['rate_markup'])
    ->set('weight_markup_type', $values['weight_markup_type'])
    ->set('weight_markup', $values['weight_markup'])
    ->set('all_in_one', $values['all_in_one'])
    ->set('insurance', $values['insurance'])
    ->set('delivery_confirmation', $values['delivery_confirmation'])
    ->set('signature_confirmation', $values['signature_confirmation'])
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('The configuration options have been saved.'));

  // @todo Still need these two lines?
  // cache_clear_all();
  // drupal_theme_rebuild();
  parent::submitForm($form, $form_state);
}