+
+ // If the completed migration has any follow-up migrations, add them
+ // to the batch migrations.
+ // @see onPostImport()
+ if (!empty(static::$followUpMigrations)) {
+ foreach (static::$followUpMigrations as $migration_id => $migration) {
+ if (!in_array($migration_id, $context['sandbox']['migration_ids'], TRUE)) {
+ // Add the follow-up migration ID to the batch migration IDs for
+ // later execution.
+ $context['sandbox']['migration_ids'][] = $migration_id;
+ // Increase the number of migrations in the batch to update the
+ // progress bar and keep it accurate.
+ $context['sandbox']['max']++;
+ // Unset the follow-up migration to make sure it won't get added
+ // to the batch twice.
+ unset(static::$followUpMigrations[$migration_id]);
+ }
+ }
+ }