You are here

function core_event_dispatcher_entity_presave in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/core_event_dispatcher/core_event_dispatcher.module \core_event_dispatcher_entity_presave()

Implements hook_entity_presave().

2 calls to core_event_dispatcher_entity_presave()
EntityEventTest::testEntityPresaveEvent in modules/core_event_dispatcher/tests/src/Unit/Entity/EntityEventTest.php
Test EntityPresaveEvent.
EntityEventTest::testEntityPresaveEventWithoutOriginal in modules/core_event_dispatcher/tests/src/Unit/Entity/EntityEventTest.php
Test EntityPresaveEvent without original.

File

modules/core_event_dispatcher/core_event_dispatcher.module, line 216
Core event dispatcher submodule.

Code

function core_event_dispatcher_entity_presave(EntityInterface $entity) {

  /** @var \Drupal\hook_event_dispatcher\Manager\HookEventDispatcherManagerInterface $manager */
  $manager = Drupal::service('hook_event_dispatcher.manager');
  $manager
    ->register(new EntityPresaveEvent($entity));
}