You are here

public function ExampleEntityEventSubscribers::entityInsert in Hook Event Dispatcher 8

Entity insert.

Parameters

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

File

src/Example/ExampleEntityEventSubscribers.php, line 64

Class

ExampleEntityEventSubscribers
Class ExampleEntityEventSubscribers.

Namespace

Drupal\hook_event_dispatcher\Example

Code

public function entityInsert(EntityInsertEvent $event) {

  // Do some fancy stuff with new entity.
  $entity = $event
    ->getEntity();
  $entity->special_field->value = 'Insert!';
}