From 887850ec2d77d4ef2a88c0c6fed410f6d9183635 Mon Sep 17 00:00:00 2001 From: webchick <drupal@webchick.net> Date: Wed, 2 Sep 2015 09:41:13 -0700 Subject: [PATCH] Issue #2484405 by phenaproxima, quietone, neclimdul: User pictures do not need a dedicated process plugin --- .../user/migration_templates/d6_user.yml | 7 ++- .../user/migration_templates/d7_user.yml | 5 +- .../Plugin/migrate/process/d6/UserPicture.php | 63 ------------------- 3 files changed, 8 insertions(+), 67 deletions(-) delete mode 100644 core/modules/user/src/Plugin/migrate/process/d6/UserPicture.php diff --git a/core/modules/user/migration_templates/d6_user.yml b/core/modules/user/migration_templates/d6_user.yml index 05ff4a00e5e1..00dba32e6f7a 100644 --- a/core/modules/user/migration_templates/d6_user.yml +++ b/core/modules/user/migration_templates/d6_user.yml @@ -23,7 +23,8 @@ process: migration: d6_user_role source: roles user_picture: - plugin: d6_user_picture + plugin: migration + migration: d6_user_picture_file source: uid destination: plugin: entity:user @@ -33,5 +34,5 @@ migration_dependencies: - d6_user_role optional: - d6_user_picture_file - - d6_user_picture_entity_display - - d6_user_picture_entity_form_display + - user_picture_entity_display + - user_picture_entity_form_display diff --git a/core/modules/user/migration_templates/d7_user.yml b/core/modules/user/migration_templates/d7_user.yml index 6dfe270569a2..6dbbde9e0d81 100755 --- a/core/modules/user/migration_templates/d7_user.yml +++ b/core/modules/user/migration_templates/d7_user.yml @@ -24,7 +24,10 @@ process: plugin: migration migration: d7_user_role source: roles - user_picture: picture + user_picture: + plugin: migration + migration: d7_file + source: picture destination: plugin: entity:user migration_dependencies: diff --git a/core/modules/user/src/Plugin/migrate/process/d6/UserPicture.php b/core/modules/user/src/Plugin/migrate/process/d6/UserPicture.php deleted file mode 100644 index 8438092bc9a6..000000000000 --- a/core/modules/user/src/Plugin/migrate/process/d6/UserPicture.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\user\Plugin\migrate\process\d6\UserPicture. - */ - -namespace Drupal\user\Plugin\migrate\process\d6; - -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\Entity\MigrationInterface; -use Drupal\migrate\MigrateExecutableInterface; -use Drupal\migrate\Plugin\MigrateProcessInterface; -use Drupal\migrate\ProcessPluginBase; -use Drupal\migrate\Row; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * The user picture process plugin. - * - * @MigrateProcessPlugin( - * id = "d6_user_picture" - * ) - */ -class UserPicture extends ProcessPluginBase implements ContainerFactoryPluginInterface { - - /** - * The migration plugin. - * - * @var \Drupal\migrate\Plugin\MigrateProcessInterface - */ - protected $migrationPlugin; - - /** - * {@inheritdoc} - */ - public function __construct(array $configuration, $plugin_id, array $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->migration = $migration; - $this->migrationPlugin = $migration_plugin; - } - - /** - * {@inheritdoc} - */ - 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('plugin.manager.migrate.process')->createInstance('migration', array('migration' => 'd6_user_picture_file'), $migration) - ); - } - - /** - * {@inheritdoc} - */ - public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - return $row->getSourceProperty('picture') ? $this->migrationPlugin->transform($value, $migrate_executable, $row, $destination_property) : NULL; - } - -} -- GitLab