public function ExampleEntityEventSubscribers::entityDelete in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 examples/ExampleEntityEventSubscribers.php \Drupal\hook_event_dispatcher\ExampleEntityEventSubscribers::entityDelete()
Entity delete.
Parameters
\Drupal\core_event_dispatcher\Event\Entity\EntityDeleteEvent $event: The event.
File
- examples/
ExampleEntityEventSubscribers.php, line 99
Class
- ExampleEntityEventSubscribers
- Class ExampleEntityEventSubscribers.
Namespace
Drupal\hook_event_dispatcherCode
public function entityDelete(EntityDeleteEvent $event) : void {
// Do some fancy stuff, after entity is deleted.
$entity = $event
->getEntity();
$entity->special_field->value = 'Deleted!';
}