You are here

public function ExampleEntityEventSubscribers::entityPreDelete in Hook Event Dispatcher 8

Entity pre delete.

Parameters

\Drupal\hook_event_dispatcher\Event\Entity\EntityPredeleteEvent $event: The event.

File

src/Example/ExampleEntityEventSubscribers.php, line 88

Class

ExampleEntityEventSubscribers
Class ExampleEntityEventSubscribers.

Namespace

Drupal\hook_event_dispatcher\Example

Code

public function entityPreDelete(EntityPredeleteEvent $event) {

  // Do something before entity is deleted.
  $entity = $event
    ->getEntity();
  $entity->special_field->value = 'PreDelete!';
}