TaxonomyTermEntityClone.php in Entity Clone 8
File
src/EntityClone/Content/TaxonomyTermEntityClone.php
View source
<?php
namespace Drupal\entity_clone\EntityClone\Content;
use Drupal\Core\Entity\EntityInterface;
class TaxonomyTermEntityClone extends ContentEntityCloneBase {
public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, array $properties = [], array &$already_cloned = []) {
if (!isset($cloned_entity->parent->target_id)) {
$cloned_entity
->set('parent', 0);
}
return parent::cloneEntity($entity, $cloned_entity, $properties);
}
}