public function ExampleEntityEventSubscribers::entityPreDelete in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x 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!';
}