diff --git a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php index 94135fd..7a720bc 100644 --- a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php +++ b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php @@ -67,7 +67,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return [ 'ip' => $this->t('The blocked IP address.'), ]; diff --git a/core/modules/comment/migration_templates/d6_comment_field.yml b/core/modules/comment/migration_templates/d6_comment_field.yml index 469d604..d14d1aa 100644 --- a/core/modules/comment/migration_templates/d6_comment_field.yml +++ b/core/modules/comment/migration_templates/d6_comment_field.yml @@ -13,7 +13,10 @@ process: type: 'constants/type' 'settings/comment_type': comment_type destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - comment migration_dependencies: required: - d6_comment_type diff --git a/core/modules/field/migration_templates/d6_field.yml b/core/modules/field/migration_templates/d6_field.yml index 531bc13..353b47e 100644 --- a/core/modules/field/migration_templates/d6_field.yml +++ b/core/modules/field/migration_templates/d6_field.yml @@ -128,4 +128,4 @@ process: - global_settings destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config diff --git a/core/modules/file/migration_templates/d6_upload_field.yml b/core/modules/file/migration_templates/d6_upload_field.yml index c0b4569..a919f91 100644 --- a/core/modules/file/migration_templates/d6_upload_field.yml +++ b/core/modules/file/migration_templates/d6_upload_field.yml @@ -20,4 +20,7 @@ process: cardinality: 'constants/cardinality' 'settings/display_field': 'constants/display_field' destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - file diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php index 0f69308..11b28c9 100644 --- a/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php +++ b/core/modules/migrate/src/Plugin/MigrateDestinationInterface.php @@ -39,17 +39,11 @@ public function getIds(); * Derived classes must implement fields(), returning a list of available * destination fields. * - * @todo Review the cases where we need the Migration parameter, can we avoid - * that? To be resolved with https://www.drupal.org/node/2543568. - * - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * (optional) The migration containing this destination. Defaults to NULL. - * * @return array * - Keys: machine names of the fields * - Values: Human-friendly descriptions of the fields. */ - public function fields(MigrationInterface $migration = NULL); + public function fields(); /** * Import the row. diff --git a/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php b/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php index a3b174a..dfe72d6 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php @@ -47,7 +47,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { // This is intentionally left empty. } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Config.php b/core/modules/migrate/src/Plugin/migrate/destination/Config.php index 32d5e1b..4277a2a 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/Config.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/Config.php @@ -97,7 +97,7 @@ public function import(Row $row, array $old_destination_id_values = array()) { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { // @todo Dynamically fetch fields using Config Schema API. } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php index 1b2c2e7..6a76551 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/Entity.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/Entity.php @@ -106,7 +106,7 @@ public function getBundle(Row $row) { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { // TODO: Implement fields() method. } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/NullDestination.php b/core/modules/migrate/src/Plugin/migrate/destination/NullDestination.php index 878a183..3c27d28 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/NullDestination.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/NullDestination.php @@ -25,7 +25,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return array(); } diff --git a/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php b/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php index 45420d3..6a40983 100644 --- a/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php +++ b/core/modules/migrate/tests/modules/migrate_events_test/src/Plugin/migrate/destination/DummyDestination.php @@ -2,7 +2,6 @@ namespace Drupal\migrate_events_test\Plugin\migrate\destination; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\DestinationBase; use Drupal\migrate\Row; @@ -25,7 +24,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return ['value' => 'Dummy value']; } diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php b/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php index cc8431d..5aa4f99 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/destination/EntityFieldStorageConfig.php @@ -2,87 +2,19 @@ namespace Drupal\migrate_drupal\Plugin\migrate\destination; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Field\FieldTypePluginManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig as BaseEntityFieldStorageConfig; /** - * Destination with Drupal specific config dependencies. + * Deprecated. Destination with Drupal specific config dependencies. * * @MigrateDestination( * id = "md_entity:field_storage_config" * ) + * + * @deprecated in Drupal 8.2.x and will be removed before Drupal 9.0.x. Use + * \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig + * instead. + * + * @see \Drupal\migrate\Plugin\migrate\destination\EntityFieldStorageConfig */ -class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig { - - /** - * The field type plugin manager. - * - * @var \Drupal\Core\Field\FieldTypePluginManagerInterface - */ - protected $fieldTypePluginManager; - - /** - * Construct a new plugin. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\migrate\Plugin\MigrationInterface $migration - * The migration. - * @param EntityStorageInterface $storage - * The storage for this entity type. - * @param array $bundles - * The list of bundles this entity type has. - * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager - * The field type plugin manager. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, FieldTypePluginManagerInterface $field_type_plugin_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles); - $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('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'; - } - -} +class EntityFieldStorageConfig extends BaseEntityFieldStorageConfig { } diff --git a/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php b/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php index 3146990..269cd69 100644 --- a/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php +++ b/core/modules/path/src/Plugin/migrate/destination/UrlAlias.php @@ -81,7 +81,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return [ 'pid' => 'The path id', 'source' => 'The source path.', diff --git a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php index cd86f0f..4e85bb9 100644 --- a/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php +++ b/core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php @@ -73,7 +73,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return [ 'uid' => 'The users.uid for this set.', 'source' => 'The shortcut_set.set_name that will be displayed for this user.', diff --git a/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml b/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml index a1c9735..0e1a487 100644 --- a/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml +++ b/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml @@ -22,7 +22,10 @@ process: 'settings/target_type': 'constants/target_entity_type' cardinality: cardinality destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - entity_reference migration_dependencies: required: - d6_taxonomy_vocabulary diff --git a/core/modules/user/migration_templates/user_picture_field.yml b/core/modules/user/migration_templates/user_picture_field.yml index a484ab8..ff8bd82 100644 --- a/core/modules/user/migration_templates/user_picture_field.yml +++ b/core/modules/user/migration_templates/user_picture_field.yml @@ -18,4 +18,7 @@ process: type: 'constants/type' cardinality: 'constants/cardinality' destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config + dependencies: + module: + - image diff --git a/core/modules/user/migration_templates/user_profile_field.yml b/core/modules/user/migration_templates/user_profile_field.yml index bf81898..3ba0eee 100644 --- a/core/modules/user/migration_templates/user_profile_field.yml +++ b/core/modules/user/migration_templates/user_profile_field.yml @@ -32,4 +32,4 @@ process: map: list: -1 destination: - plugin: md_entity:field_storage_config + plugin: entity:field_storage_config diff --git a/core/modules/user/src/Plugin/migrate/destination/UserData.php b/core/modules/user/src/Plugin/migrate/destination/UserData.php index 6ca6017..13bcab6 100644 --- a/core/modules/user/src/Plugin/migrate/destination/UserData.php +++ b/core/modules/user/src/Plugin/migrate/destination/UserData.php @@ -78,7 +78,7 @@ public function getIds() { /** * {@inheritdoc} */ - public function fields(MigrationInterface $migration = NULL) { + public function fields() { return [ 'uid' => 'The user id.', 'module' => 'The module name responsible for the settings.',