save(); } $shared_configuration = $group->get('shared_configuration'); if (empty($shared_configuration)) { continue; } foreach ($shared_configuration as $key => $group_value) { $migration_value = $migrations[$id][$key] ?? NULL; // Where both the migration and the group provide arrays, replace // recursively (so each key collision is resolved in favor of the // migration). if (is_array($migration_value) && is_array($group_value)) { $merged_values = array_replace_recursive($group_value, $migration_value); $migrations[$id][$key] = $merged_values; } // Where the group provides a value the migration doesn't, use the group // value. elseif (is_null($migration_value)) { $migrations[$id][$key] = $group_value; } // Otherwise, the existing migration value overrides the group value. } } } /** * Implements hook_migrate_prepare_row(). */ function migrate_plus_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration): void { \Drupal::service('event_dispatcher')->dispatch(new MigratePrepareRowEvent($row, $source, $migration), MigrateEvents::PREPARE_ROW); }