public function ExampleEntityEventSubscribers::entityPreDelete in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 examples/ExampleEntityEventSubscribers.php \Drupal\hook_event_dispatcher\ExampleEntityEventSubscribers::entityPreDelete()
Entity pre delete.
Parameters
\Drupal\core_event_dispatcher\Event\Entity\EntityPredeleteEvent $event: The event.
File
- examples/
ExampleEntityEventSubscribers.php, line 87
Class
- ExampleEntityEventSubscribers
- Class ExampleEntityEventSubscribers.
Namespace
Drupal\hook_event_dispatcherCode
public function entityPreDelete(EntityPredeleteEvent $event) : void {
// Do something before entity is deleted.
$entity = $event
->getEntity();
$entity->special_field->value = 'PreDelete!';
}