class TaxonomyTermEntityClone in Entity Clone 8
Class TaxonomyTermEntityClone.
Hierarchy
- class \Drupal\entity_clone\EntityClone\Content\ContentEntityCloneBase implements EntityHandlerInterface, EntityCloneInterface
- class \Drupal\entity_clone\EntityClone\Content\TaxonomyTermEntityClone
Expanded class hierarchy of TaxonomyTermEntityClone
1 file declares its use of TaxonomyTermEntityClone
- entity_clone.module in ./
entity_clone.module - Contains entity_clone.module.
File
- src/
EntityClone/ Content/ TaxonomyTermEntityClone.php, line 10
Namespace
Drupal\entity_clone\EntityClone\ContentView source
class TaxonomyTermEntityClone extends ContentEntityCloneBase {
/**
* {@inheritdoc}
*/
public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, array $properties = [], array &$already_cloned = []) {
/** @var \Drupal\core\Entity\ContentEntityInterface $cloned_entity */
// Enforce a parent if the cloned term doesn't have a parent.
// (First level of a taxonomy tree).
if (!isset($cloned_entity->parent->target_id)) {
$cloned_entity
->set('parent', 0);
}
return parent::cloneEntity($entity, $cloned_entity, $properties);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentEntityCloneBase:: |
protected | property | The current user. | |
ContentEntityCloneBase:: |
protected | property | The entity type ID. | |
ContentEntityCloneBase:: |
protected | property | The entity type manager. | |
ContentEntityCloneBase:: |
protected | property | A service for obtaining the system's time. | |
ContentEntityCloneBase:: |
protected | function | Clones referenced entities. | |
ContentEntityCloneBase:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: |
|
ContentEntityCloneBase:: |
protected | function | Determines if a field is clonable. | |
ContentEntityCloneBase:: |
protected | function | Fetches the properties of a child entity. | |
ContentEntityCloneBase:: |
protected | function | Sets the cloned entity's label. | |
ContentEntityCloneBase:: |
public | function | Constructs a new ContentEntityCloneBase. | |
TaxonomyTermEntityClone:: |
public | function |
Clone an entity. Overrides ContentEntityCloneBase:: |