EmptySource.php in Drupal 10
File
core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php
View source
<?php
namespace Drupal\migrate_drupal\Plugin\migrate\source;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Core\Entity\DependencyTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\source\EmptySource as BaseEmptySource;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInterface, DependentPluginInterface {
use DependencyTrait;
protected $entityTypeManager;
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
$this->entityTypeManager = $entity_type_manager;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
return new static($configuration, $plugin_id, $plugin_definition, $migration, $container
->get('entity_type.manager'));
}
public function calculateDependencies() {
if (isset($this->configuration['constants']['entity_type'])) {
$this
->addDependency('module', $this->entityTypeManager
->getDefinition($this->configuration['constants']['entity_type'])
->getProvider());
}
return $this->dependencies;
}
}
Classes
Name |
Description |
EmptySource |
Source returning an empty row with Drupal specific config dependencies. |