public static function Custom::removeRateSubmit in Commerce Core 8.2
Submit callback for removing a rate.
File
- modules/
tax/ src/ Plugin/ Commerce/ TaxType/ Custom.php, line 258
Class
- Custom
- Provides the Custom tax type.
Namespace
Drupal\commerce_tax\Plugin\Commerce\TaxTypeCode
public static function removeRateSubmit(array $form, FormStateInterface $form_state) {
$rates = $form_state
->get('rates');
$index = $form_state
->getTriggeringElement()['#rate_index'];
unset($rates[$index]);
$form_state
->set('rates', $rates);
$form_state
->setRebuild();
}