X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate_drupal%2Fsrc%2FPlugin%2Fmigrate%2Fdestination%2FEntityFieldStorageConfig.php;fp=web%2Fcore%2Fmodules%2Fmigrate_drupal%2Fsrc%2FPlugin%2Fmigrate%2Fdestination%2FEntityFieldStorageConfig.php;h=43df17057da910ec66c12113e359bfa76951a64e;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php b/web/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php new file mode 100644 index 000000000..43df17057 --- /dev/null +++ b/web/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php @@ -0,0 +1,104 @@ +languageManager = $language_manager; + $this->configFactory = $config_factory; + $this->fieldTypePluginManager = $field_type_plugin_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + $entity_type_id = static::getEntityTypeId($plugin_id); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $migration, + $container->get('entity.manager')->getStorage($entity_type_id), + array_keys($container->get('entity.manager')->getBundleInfo($entity_type_id)), + $container->get('language_manager'), + $container->get('config.factory'), + $container->get('plugin.manager.field.field_type') + ); + } + + /** + * {@inheritdoc} + */ + public function calculateDependencies() { + $this->dependencies = parent::calculateDependencies(); + // Add a dependency on the module that provides the field type using the + // source plugin configuration. + $source_configuration = $this->migration->getSourceConfiguration(); + if (isset($source_configuration['constants']['type'])) { + $field_type = $this->fieldTypePluginManager->getDefinition($source_configuration['constants']['type']); + $this->addDependency('module', $field_type['provider']); + } + return $this->dependencies; + } + + /** + * {@inheritdoc} + */ + protected static function getEntityTypeId($plugin_id) { + return 'field_storage_config'; + } + +}