You are here

public function ExampleEntityEventSubscribers::entityUpdate in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 examples/ExampleEntityEventSubscribers.php \Drupal\hook_event_dispatcher\ExampleEntityEventSubscribers::entityUpdate()

Entity update.

Parameters

\Drupal\core_event_dispatcher\Event\Entity\EntityUpdateEvent $event: The event.

File

examples/ExampleEntityEventSubscribers.php, line 75

Class

ExampleEntityEventSubscribers
Class ExampleEntityEventSubscribers.

Namespace

Drupal\hook_event_dispatcher

Code

public function entityUpdate(EntityUpdateEvent $event) : void {

  // Do some fancy stuff, when entity is updated.
  $entity = $event
    ->getEntity();
  $entity->special_field->value = 'Update!';
}