Allow exporting specific fields as reference only

Created on 17 February 2025, about 2 months ago

Problem/Motivation

The module by default exports all references as inline entities. For some cases, it is good, for others - not.

Steps to reproduce

1. Get the default Drupal setup.
2. On the Basic Page node type configure a reference field field_related_articles referencing to articles.
3. Create an article, and a page with a reference to the article.
4. Export all the content to files.
5. See that the exported page yaml contains full information about the article, instead of just uuid as the reference.

And a simpler example - Article with Taxonomy Tags, if we have 100 articles with the same tag, this tag details (name, description, custom fields) will be duplicated 100 times in each article's yaml file, instead of storing just uuid as the reference.

Proposed resolution

It's not easy to autodetect which referenced fields should be exported inline, and which - contain only id as a reference.

So let's make it up to the user, to manually set which reference fields should be exported only as reference, without referenced entities data.

Something like:

drush content:export node --export-as-reference=field_related_articles

What do you think about this?

And in later implementation, we can go deeper, and add an option to export the reference as a separate file, which will be convenient in some cases.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.4

Component

Code

Created by

πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024