PardotContactFormMapDeleteForm.php in Pardot Integration 8
File
src/Form/PardotContactFormMapDeleteForm.php
View source
<?php
namespace Drupal\pardot\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
class PardotContactFormMapDeleteForm extends EntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to delete Pardot Contact Form Mapping %label?', array(
'%label' => $this->entity
->label(),
));
}
public function getDescription() {
return $this
->t('Are you sure you want to delete Pardot Contact Form Mapping %label? This action cannot be undone.', array(
'%label' => $this->entity
->label(),
));
}
public function getConfirmText() {
return $this
->t('Delete Pardot Contact Form Mapping');
}
public function getCancelUrl() {
return new Url('pardot.pardot_contact_form_map.list');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->delete();
drupal_set_message($this
->t('Pardot Contact Form Mapping %label was deleted.', array(
'%label' => $this->entity
->label(),
)));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}