3 namespace Drupal\migrate_drupal\Plugin\migrate\destination;
5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Entity\EntityStorageInterface;
7 use Drupal\Core\Field\FieldTypePluginManagerInterface;
8 use Drupal\Core\Language\LanguageManagerInterface;
9 use Symfony\Component\DependencyInjection\ContainerInterface;
10 use Drupal\migrate\Plugin\MigrationInterface;
11 use Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig as BaseEntityFieldStorageConfig;
14 * Deprecated. Destination with Drupal specific config dependencies.
16 * @MigrateDestination(
17 * id = "md_entity:field_storage_config"
20 * @deprecated in Drupal 8.2.x and will be removed in Drupal 9.0.x. Use
21 * \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig
24 * @see \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig
26 class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig {
29 * The field type plugin manager.
31 * @var \Drupal\Core\Field\FieldTypePluginManagerInterface
33 protected $fieldTypePluginManager;
36 * Construct a new plugin.
38 * @param array $configuration
39 * A configuration array containing information about the plugin instance.
40 * @param string $plugin_id
41 * The plugin_id for the plugin instance.
42 * @param mixed $plugin_definition
43 * The plugin implementation definition.
44 * @param \Drupal\migrate\Plugin\MigrationInterface $migration
46 * @param \Drupal\Core\Entity\EntityStorageInterface $storage
47 * The storage for this entity type.
48 * @param array $bundles
49 * The list of bundles this entity type has.
50 * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
51 * The language manager.
52 * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
53 * The configuration factory.
54 * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager
55 * The field type plugin manager.
57 public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, FieldTypePluginManagerInterface $field_type_plugin_manager) {
58 parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $language_manager, $config_factory, $field_type_plugin_manager);
59 $this->languageManager = $language_manager;
60 $this->configFactory = $config_factory;
61 $this->fieldTypePluginManager = $field_type_plugin_manager;
67 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
68 $entity_type_id = static::getEntityTypeId($plugin_id);
74 $container->get('entity.manager')->getStorage($entity_type_id),
75 array_keys($container->get('entity.manager')->getBundleInfo($entity_type_id)),
76 $container->get('language_manager'),
77 $container->get('config.factory'),
78 $container->get('plugin.manager.field.field_type')
85 public function calculateDependencies() {
86 $this->dependencies = parent::calculateDependencies();
87 // Add a dependency on the module that provides the field type using the
88 // source plugin configuration.
89 $source_configuration = $this->migration->getSourceConfiguration();
90 if (isset($source_configuration['constants']['type'])) {
91 $field_type = $this->fieldTypePluginManager->getDefinition($source_configuration['constants']['type']);
92 $this->addDependency('module', $field_type['provider']);
94 return $this->dependencies;
100 protected static function getEntityTypeId($plugin_id) {
101 return 'field_storage_config';