You are here

public function MyEntityCloneEventSubscriber::myPreClone in Entity Clone 8

An example event subscriber.

Dispatched before an entity is cloned and saved.

See also

\Drupal\entity_clone\Event\EntityCloneEvents::PRE_CLONE

File

./entity_clone.api.php, line 37
Entity Clone hooks and events.

Class

MyEntityCloneEventSubscriber
Event subscribers for Entity Clone.

Code

public function myPreClone(\Drupal\entity_clone\Event\EntityCloneEvent $event) : void {
  $original = $event
    ->getEntity();
  $newEntity = $event
    ->getClonedEntity();
}