recurring_events-2.0.x-dev/modules/recurring_events_ical/src/Form/EventICalMappingDeleteForm.php
modules/recurring_events_ical/src/Form/EventICalMappingDeleteForm.php
<?php
declare(strict_types=1);
namespace Drupal\recurring_events_ical\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Form handler for the event iCal property mapping delete form.
*/
class EventICalMappingDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this->t('Are you sure you want to delete %name?', [
'%name' => $this->entity->label(),
]);
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
return $this->entity->toUrl('collection');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this->t('Delete');
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
$this->messenger()->addMessage($this->t('%label iCalendar property mapping has been deleted.', [
'%label' => $this->entity->label(),
]));
$form_state->setRedirectUrl($this->getCancelUrl());
}
}
