diff --git a/core/modules/migrate_drupal/src/MigrationStorage.php b/core/modules/migrate_drupal/src/MigrationStorage.php index 43509fe..812933f 100644 --- a/core/modules/migrate_drupal/src/MigrationStorage.php +++ b/core/modules/migrate_drupal/src/MigrationStorage.php @@ -136,14 +136,16 @@ public function save(EntityInterface $entity) { * An array of migration entities. */ protected function applyCckFieldProcessors(array $entities) { + $method_map = $this->getMigrationPluginMethodMap(); /** @var \Drupal\migrate\Entity\Migration $migration */ foreach ($entities as $entity_id => $migration) { // Allow field plugins to process the required migrations. - foreach ($this->getCckFieldPlugins() as $plugin) { - if ($method = $this->getMigrationPluginMethod($entity_id)) { + if (isset($method_map[$entity_id])) { + $method = $method_map[$entity_id]; + array_walk($this->getCckFieldPlugins(), function ($plugin) use ($method, $migration) { $plugin->$method($migration); - } + }); } // If this is a CCK bundle migration, allow the cck field plugins to add @@ -179,23 +181,15 @@ protected function getCckFieldPlugins() { /** * Provides a map between migration ids and the cck field plugin method. * - * @param string $entity_id - * The migration entity id. - * - * @return bool|string - * The method to call on the processing plugin or FALSE. + * @return array + * The map between migrations and cck field plugin processing methods. */ - protected function getMigrationPluginMethod($entity_id) { - $map = [ + protected function getMigrationPluginMethodMap() { + return [ 'd6_field' => 'processField', 'd6_field_instance_widget_settings' => 'processFieldWidget', 'd6_field_formatter_settings' => 'processFieldDisplay', ]; - if (isset($map[$entity_id])) { - return $map[$entity_id]; - } - - return FALSE; } /**