Problem/Motivation
Add support for the custom_field module, so entities using that field can be exported and imported using Default Content (or Drupal core recipe importer).
Export functionality for most custom_field data types are working out of the box, but the ones referencing entities will export the entity target IDs, rather than UUIDs used by the importer.
Steps to reproduce
- Install Default Content & custom_field
- Set up a custom_field field, containing (amongst others) an image field or entity reference field.
- Try export / import functionality.
Proposed resolution
- Add support for custom_field entity references in the Normalizer class.
| Comment | File | Size | Author |
|---|
Issue fork default_content-3532596
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
svendecabooterCreated an MR that updates custom_field data in the Default Content export for referenced entities.
Original output without this MR:
After applying this MR. this becomes:
The referenced UUIDs also get added as a dependency to the "_meta" definition.
Comment #4
svendecabooterOn the import side of things, there is a patch for custom_field that makes this work: #3528586: Support Drupal core DefaultContent API.
Comment #5
svendecabooterComment #6
svendecabooterAttached is a patch file for the current state of the MR, useful for Composer based patching workflows.
Comment #7
apmsooner commented@svendecabooter,
Building on my comment in https://www.drupal.org/project/custom_field/issues/3528586#comment-16166705, it might just make best sense to create a reference type base class in custom_field that those 3 types extend so that this patch here can just depend on a single class. Forward thinking here in case we were to add new similar data types in custom_field so we don't have to go back and request a change again here.
Comment #8
apmsooner commentedThis patch would put a dependency on custom_field module. Needs to just check for the class as string vs. requiring the interface.
Comment #9
svendecabooterDependency on custom_field removed, by explicitly checking if the module is enabled.
Comment #10
apmsooner commentedComment #11
phenaproximaCore now has a default context exporter (it will be released in 11.3.0), and it is pluggable. I would suggest that custom_field integrate with that directly instead. :)
See https://www.drupal.org/node/3533854 for details.
Comment #12
berdirFWIW, I don't think the importer (which this also has to integrate with) is pluggable enough yet, as we discussed the pre import event is called once for all entities. I think we should add an import event as well, others might need that as well