public function TaxRateMethodsForm::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_tax/
src/ Form/ TaxRateMethodsForm.php, line 123
Class
- TaxRateMethodsForm
- Displays a list of tax methods and rates.
Namespace
Drupal\uc_tax\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$enabled = [];
$method_weight = [];
foreach ($form_state
->getValue('methods') as $rate_id => $rate) {
$enabled[$rate_id] = $rate['status'];
$method_weight[$rate_id] = $rate['weight'];
}
$tax_config = $this
->config('uc_tax.settings');
$tax_config
->set('enabled', $enabled)
->set('method_weight', $method_weight)
->set('type_weight', $form_state
->getValue('uc_tax_type_weight'))
->save();
return parent::submitForm($form, $form_state);
}