SignupDeleteForm.php in SendinBlue 8.2
Same filename and directory in other branches
Namespace
Drupal\sendinblue\FormFile
src/Form/SignupDeleteForm.phpView source
<?php
namespace Drupal\sendinblue\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Provides a form for deleting a content_entity_example entity.
*
* @ingroup content_entity_example
*/
class SignupDeleteForm extends ContentEntityConfirmFormBase {
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this
->t('Are you sure you want to delete entity %name?', [
'%name' => $this->entity
->label(),
]);
}
/**
* {@inheritdoc}
*
* If the delete command is canceled, return to the contact list.
*/
public function getCancelUrl() {
return new Url('entity.sendinblue_signup_form.collection');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this
->t('Delete');
}
/**
* {@inheritdoc}
*
* Delete the entity and log the event. log() replaces the watchdog.
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $this
->getEntity();
$entity
->delete();
$this
->logger('sendinblue_signup_form')
->notice('@type: deleted %title.', [
'@type' => $this->entity
->bundle(),
'%title' => $this->entity
->label(),
]);
$form_state
->setRedirect('entity.sendinblue_signup_form.collection');
}
}
Classes
Name | Description |
---|---|
SignupDeleteForm | Provides a form for deleting a content_entity_example entity. |