class FieldConfigEntityClone in Entity Clone 8
Class FieldConfigEntityClone.
Hierarchy
- class \Drupal\entity_clone\EntityClone\Config\ConfigEntityCloneBase implements EntityHandlerInterface, EntityCloneInterface
- class \Drupal\entity_clone\EntityClone\Config\FieldConfigEntityClone
Expanded class hierarchy of FieldConfigEntityClone
1 file declares its use of FieldConfigEntityClone
- entity_clone.module in ./
entity_clone.module - Contains entity_clone.module.
File
- src/
EntityClone/ Config/ FieldConfigEntityClone.php, line 10
Namespace
Drupal\entity_clone\EntityClone\ConfigView source
class FieldConfigEntityClone extends ConfigEntityCloneBase {
/**
* {@inheritdoc}
*/
public function cloneEntity(EntityInterface $field_config, EntityInterface $cloned_field_config, array $properties = []) {
/** @var \Drupal\field\Entity\FieldConfig $field_config */
/** @var \Drupal\field\Entity\FieldConfig $cloned_field_config */
/** @var \Drupal\field\Entity\FieldStorageConfig $cloned_field_storage */
if (!isset($properties['skip_storage']) || !$properties['skip_storage']) {
$cloned_field_storage = $field_config
->getFieldStorageDefinition()
->createDuplicate();
$cloned_field_storage
->set('field_name', $properties['id']);
$cloned_field_storage
->set('id', $properties['id'] . '.' . $cloned_field_storage
->getTargetEntityTypeId());
$cloned_field_storage
->save();
}
unset($properties['skip_storage']);
$properties['field_name'] = $properties['id'];
$properties['id'] = $cloned_field_config
->getTargetEntityTypeId() . '.' . $cloned_field_config
->getTargetBundle() . '.' . $properties['id'];
return parent::cloneEntity($field_config, $cloned_field_config, $properties);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigEntityCloneBase:: |
protected | property | The entity type ID. | |
ConfigEntityCloneBase:: |
protected | property | The entity type manager. | |
ConfigEntityCloneBase:: |
public static | function |
Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: |
1 |
ConfigEntityCloneBase:: |
public | function | Constructs a new ConfigEntityCloneBase. | 1 |
FieldConfigEntityClone:: |
public | function |
Clone an entity. Overrides ConfigEntityCloneBase:: |