RngContactDeleteForm.php in RNG Contact 8
File
src/Form/RngContactDeleteForm.php
View source
<?php
namespace Drupal\rng_contact\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
class RngContactDeleteForm extends ContentEntityConfirmFormBase {
public function getQuestion() {
return t('Are you sure you want to delete this contact?');
}
public function getCancelUrl() {
return $this->entity
->urlInfo();
}
public function getConfirmText() {
return t('Delete');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$contact = $this->entity;
$contact
->delete();
drupal_set_message(t('Contact deleted.'));
}
}