You are here

public function UPSSettingsForm::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_ups/src/Form/UPSSettingsForm.php, line 345

Class

UPSSettingsForm
Configures UPS settings.

Namespace

Drupal\uc_ups\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $ups_config = $this
    ->config('uc_ups.settings');
  $values = $form_state
    ->getValues();
  $ups_config
    ->set('access_license', $values['access_license'])
    ->set('shipper_number', $values['shipper_number'])
    ->set('user_id', $values['user_id'])
    ->set('password', $values['password'])
    ->set('connection_address', $values['connection_address'])
    ->set('services', $values['uc_ups_services'])
    ->set('pickup_type', $values['pickup_type'])
    ->set('package_type', $values['package_type'])
    ->set('classification', $values['classification'])
    ->set('negotiated_rates', $values['negotiated_rates'])
    ->set('residential_quotes', $values['residential_quotes'])
    ->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('label_lifetime', $values['label_lifetime'])
    ->set('all_in_one', $values['all_in_one'])
    ->set('unit_system', $values['unit_system'])
    ->set('insurance', $values['insurance'])
    ->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);
}