class NodeDeleteForm
Same name and namespace in other branches
- 11.x core/modules/node/src/Form/NodeDeleteForm.php \Drupal\node\Form\NodeDeleteForm
Provides a form for deleting a node.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase extends \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm extends \Drupal\Core\Entity\EntityFormInterface implements \Drupal\Core\Form\FormBase
- class \Drupal\Core\Entity\ContentEntityForm extends \Drupal\Core\Entity\ContentEntityFormInterface implements \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\ContentEntityConfirmFormBase extends \Drupal\Core\Form\ConfirmFormInterface implements \Drupal\Core\Entity\ContentEntityForm
- class \Drupal\Core\Entity\ContentEntityDeleteForm uses \Drupal\Core\Entity\EntityDeleteFormTrait implements \Drupal\Core\Entity\ContentEntityConfirmFormBase
- class \Drupal\node\Form\NodeDeleteForm implements \Drupal\Core\Entity\ContentEntityDeleteForm
- class \Drupal\Core\Entity\ContentEntityDeleteForm uses \Drupal\Core\Entity\EntityDeleteFormTrait implements \Drupal\Core\Entity\ContentEntityConfirmFormBase
- class \Drupal\Core\Entity\ContentEntityConfirmFormBase extends \Drupal\Core\Form\ConfirmFormInterface implements \Drupal\Core\Entity\ContentEntityForm
- class \Drupal\Core\Entity\ContentEntityForm extends \Drupal\Core\Entity\ContentEntityFormInterface implements \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\EntityForm extends \Drupal\Core\Entity\EntityFormInterface implements \Drupal\Core\Form\FormBase
Expanded class hierarchy of NodeDeleteForm
File
-
core/
modules/ node/ src/ Form/ NodeDeleteForm.php, line 12
Namespace
Drupal\node\FormView source
class NodeDeleteForm extends ContentEntityDeleteForm {
/**
* {@inheritdoc}
*/
protected function getDeletionMessage() {
/** @var \Drupal\node\NodeInterface $entity */
$entity = $this->getEntity();
$node_type_storage = $this->entityTypeManager
->getStorage('node_type');
$node_type = $node_type_storage->load($entity->bundle())
->label();
if (!$entity->isDefaultTranslation()) {
return $this->t('@language translation of the @type %label has been deleted.', [
'@language' => $entity->language()
->getName(),
'@type' => $node_type,
'%label' => $entity->label(),
]);
}
return $this->t('The @type %title has been deleted.', [
'@type' => $node_type,
'%title' => $this->getEntity()
->label(),
]);
}
/**
* {@inheritdoc}
*/
protected function logDeletionMessage() {
/** @var \Drupal\node\NodeInterface $entity */
$entity = $this->getEntity();
$this->logger('content')
->notice('@type: deleted %title.', [
'@type' => $entity->getType(),
'%title' => $entity->label(),
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.