Skip to content

JSON and XML migrations not being detected?

Issue #3076725 on drupal.org by dinarcon.

Hi, thanks for the work on this module!

It works great for CSV migrations, but it seems not to be working with JSON or XML migrations. In buildForm() it uses the $migrationInstance->getSourcePlugin() method and check against classes that are instances of `Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Json` and `Drupal\migrate_plus\Plugin\migrate_plus\data_parser\XML`. Those are the data parser classes, but getSourcePlugin() actually returns the source plugin which is `Drupal\migrate_plus\Plugin\migrate\source\Url`. Therefore the validation fails for JSON and XML files.

Am I overseeing something? If this is truly a bug, an alternative would be to use $migrationInstance->getSourceConfiguration() and check the `data_parser_plugin` key. I can provide a patch if this approach is desired.