You are here

public function ExampleEntityEventSubscribers::entityPreSave in Hook Event Dispatcher 8

Entity pre save.

Parameters

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

File

src/Example/ExampleEntityEventSubscribers.php, line 53

Class

ExampleEntityEventSubscribers
Class ExampleEntityEventSubscribers.

Namespace

Drupal\hook_event_dispatcher\Example

Code

public function entityPreSave(EntityPresaveEvent $event) {
  $entity = $event
    ->getEntity();
  $entity->special_field->value = 'PreSave!';
}