class MigrateEntity in GatherContent 8.5
Class MigrateEntity.
@package Drupal\gathercontent\Plugin\Derivative
Hierarchy
- class \Drupal\gathercontent\Plugin\Derivative\MigrateEntity implements ContainerDeriverInterface
Expanded class hierarchy of MigrateEntity
File
- src/
Plugin/ Derivative/ MigrateEntity.php, line 13
Namespace
Drupal\gathercontent\Plugin\DerivativeView source
class MigrateEntity implements ContainerDeriverInterface {
/**
* List of derivative definitions.
*
* @var array
*/
protected $derivatives = [];
/**
* The entity definitions.
*
* @var \Drupal\Core\Entity\EntityTypeInterface[]
*/
protected $entityDefinitions;
/**
* Constructs a MigrateEntity object.
*
* @param \Drupal\Core\Entity\EntityTypeInterface[] $entity_definitions
* A list of entity definition objects.
*/
public function __construct(array $entity_definitions) {
$this->entityDefinitions = $entity_definitions;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager')
->getDefinitions());
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
return $this->derivatives[$derivative_id];
}
$this
->getDerivativeDefinitions($base_plugin_definition);
return $this->derivatives[$derivative_id];
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->entityDefinitions as $entity_type => $entity_info) {
$class = is_subclass_of($entity_info
->getClass(), 'Drupal\\Core\\Config\\Entity\\ConfigEntityInterface') ? 'Drupal\\migrate\\Plugin\\migrate\\destination\\EntityConfigBase' : 'Drupal\\gathercontent\\Plugin\\migrate\\destination\\GatherContentEntity';
$this->derivatives[$entity_type] = [
'id' => "gc_entity:{$entity_type}",
'class' => $class,
'requirements_met' => 1,
'provider' => $entity_info
->getProvider(),
];
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrateEntity:: |
protected | property | List of derivative definitions. | |
MigrateEntity:: |
protected | property | The entity definitions. | |
MigrateEntity:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
MigrateEntity:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
MigrateEntity:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface:: |
|
MigrateEntity:: |
public | function | Constructs a MigrateEntity object. |