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