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