diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockTheme.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockTheme.php index bad88ef..cf77da5 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockTheme.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockTheme.php @@ -41,9 +41,10 @@ class BlockTheme extends ProcessPluginBase implements ContainerFactoryPluginInte * @param \Drupal\Core\Config\Config $config * The configuration factory object. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, Config $config) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, Config $config, array $themes) { parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); $this->config = $config; + $this->themes = $themes; } /** @@ -55,7 +56,8 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $migration, - $container->get('config.factory')->get('system.theme') + $container->get('config.factory')->get('system.theme'), + $container->get('theme_handler')->listInfo() ); } @@ -67,15 +69,15 @@ public static function create(ContainerInterface $container, array $configuratio public function transform($value, MigrateExecutable $migrate_executable, Row $row, $destination_property) { list($theme, $d6_default_theme, $d6_admin_theme) = $value; - $d8_default_theme = $this->config->get('default'); - $d8_admin_theme = $this->config->get('admin'); - // If the source theme exists on the destination, we're good. - $themes = \Drupal::service('theme_handler')->listInfo(); - if (isset($themes[$theme])) { + if (isset($this->themes[$theme])) { return $theme; } + // Get the default destination themes. + $d8_default_theme = $this->config->get('default'); + $d8_admin_theme = $this->config->get('admin'); + // If the source block is assigned to a region in the source default theme, then assign it to the destination default theme. if (strtolower($theme) == strtolower($d6_default_theme)) { return $d8_default_theme;