3 namespace Drupal\migrate_drupal\Plugin\migrate\source;
5 use Drupal\Component\Plugin\DependentPluginInterface;
6 use Drupal\Core\Entity\DependencyTrait;
7 use Symfony\Component\DependencyInjection\ContainerInterface;
8 use Drupal\migrate\Plugin\MigrationInterface;
9 use Drupal\migrate\Plugin\migrate\source\EmptySource as BaseEmptySource;
10 use Drupal\Core\Entity\EntityManagerInterface;
11 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
14 * Source returning an empty row with Drupal specific config dependencies.
18 * source_module = "system",
21 class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInterface, DependentPluginInterface {
28 * @var \Drupal\Core\Entity\EntityManagerInterface
30 protected $entityManager;
35 public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityManagerInterface $entity_manager) {
36 parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
37 $this->entityManager = $entity_manager;
43 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
49 $container->get('entity.manager')
56 public function calculateDependencies() {
57 // The empty source plugin supports the entity_type constant.
58 if (isset($this->configuration['constants']['entity_type'])) {
59 $this->addDependency('module', $this->entityManager->getDefinition($this->configuration['constants']['entity_type'])->getProvider());
61 return $this->dependencies;