function hook_ENTITY_TYPE_duplicate
Acts when duplicating an existing entity of a specific type.
Parameters
\Drupal\Core\Entity\EntityInterface $duplicate: The duplicated entity object.
\Drupal\Core\Entity\EntityInterface $entity: The original entity object.
See also
Related topics
File
-
core/
lib/ Drupal/ Core/ Entity/ entity.api.php, line 1006
Code
function hook_ENTITY_TYPE_duplicate(\Drupal\Core\Entity\EntityInterface $duplicate, \Drupal\Core\Entity\EntityInterface $entity) : void {
\Drupal::logger('example')->info('ENTITY_TYPE duplicated: @label', [
'@label' => $entity->label(),
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.