PI1: CSV import UI infrastructure
Summary:
farmOS v1 provided CSV importers for each asset and log type. Due to time constraints, missing dependencies, and uncertainty over the best approach, we decided not to port CSV importers to farmOS v2 before the 2.0.0 release. Now that some time has passed, and more discussion and experimentation has taken place, we have a better idea of how to implement CSV importers in farmOS v2, and solve some of the limitations that were present in v1 at the same time.
In farmOS v2, we have the opportunity to use the new Drupal core Migrate API for CSV importers (using the Migrate Source CSV module), instead of the Feeds module that we used in v1.
The Migrate API may make some next steps easier too, like offering the ability to update records via CSV, instead of limiting it to creating records. See https://www.drupal.org/project/farm/issues/2968909
We can also add basic support for importing taxonomy terms, which was not available in v1. See https://www.drupal.org/project/farm/issues/2931181
The first step will be to build the basic infrastructure within farmOS to support Migrate-based CSV importers generally. This will provide some generic CSV importers, but also provide a framework for other modules to write their own custom CSV import templates for more specific and targeted use cases. These targeted CSV importers are outside the scope of this first step, but we can spend some time talking about use-cases to help prepare for them in future iterations.
farmOS core issue: farmOS v2 CSV import module See also: [META] farmOS 2.x Importers
Base requirements:
- Automatically provide importers for each asset/log/term type.
- Allow modules to programmatically add mappings to auto-generated importers.
- Column names must be configurable (not always field machine names).
- Allow custom CSV importers to be provided by modules as
migrate_plus.migration.*
config entities. - Provide an index of CSV importers at
/import/csv
with menu items for quick navigation. - Provide a form for each CSV importer at
/import/csv/[id]
. - Provide a downloadable template CSV file that includes all the columns.
- Provide an "Import" button on each asset/log/term list page.
- Respect entity permissions.
- Validate imported entities.
- Add CSV import documentation to the user guide, and developer docs for building custom importers.
Stretch goals:
- Provide some additional Migrate process plugins for anticipated CSV mapping use-cases.
- Update existing assets/logs/terms.
- Intermediate step for reviewing entities before they are created.
- Sync CSV export and import templates (see old v1 issue: https://www.drupal.org/project/farm/issues/2900239)