TaxRateDeleteForm.php in Ubercart 8.4
File
uc_tax/src/Form/TaxRateDeleteForm.php
View source
<?php
namespace Drupal\uc_tax\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class TaxRateDeleteForm extends EntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to delete %name?', [
'%name' => $this->entity
->label(),
]);
}
public function getConfirmText() {
return $this
->t('Delete tax rate');
}
public function getCancelUrl() {
return Url::fromRoute('entity.uc_tax_rate.collection');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
$this
->messenger()
->addMessage($this
->t('Tax rate %name has been deleted.', [
'%name' => $this->entity
->label(),
]));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}