Problem/Motivation

One of the key problems with Drupal usability per the Minnesota usability study is the inability of users to "connect the dots". One of the most glaring examples of this for content editors and authors is that if entities reference one another they cannot create the new referenced entity without leaving the form for the parent entity. For example:

Assuming,

  1. I have a 'Product' and it references a 'feature' as a multi-value field.
  2. My 'feature' contains several fields like 'description', 'image','Tags', etc.

When I add a new product I can add the referenced features from the 'Product' form (providing I have checked 'create referenced entities if they don't exist) but I can only create their titles. Once I'm done I then need to remember which features I just created, then go and find them in the content list, open them and fill out the other fields for each, save them and return to the original product to preview what I have done. If at that point I need to make changes, the process starts all over again.

If I had only three features to add it's clunky, if I have twelve it becomes really painful, and if my features also reference other content it becomes pretty unusable. Forcing the user to shuttle back and forth between a number of different pieces of content in this way is not just painful, it also puts up a barrier for users to do what we want them to do, create structured content. If it's way easier to just dump my features in the body field, that's what I'm going to do. Then when two or four or seven products share a feature I have seven different pieces of text describing the same thing (in different ways) that I have to maintain.

Proposed resolution

It doesn't have to be this way, because guess what, there's an amazing module in Drupal 8 that already does this quite well; Inline Entity Form. With IEF in core any complex content and all of it's multiple references can be created in a single shot in one form.

The fact that this is a big user need is evidenced by the fact that this module has been around for quite some time and has 149,894 installs. It's also not the only module that has attempted to tackle this or related problems (though it is the best). There are also field group, conditional fields, dynamic entity reference, entity reference pre-populate, entity embed and paragraphs. All of those handle slightly different problems than Inline Entity Form, and some may also at some point be worthy of being added to core (Particularly paragraphs) but most are solving edge cases. IEF is a broad-reaching solution that will undeniably benefit every user of Drupal.

Remaining tasks

Discuss

User interface changes

Unknown

API changes

Unknown

Data model changes

Unknown

Comments

larowlan created an issue. See original summary.

larowlan’s picture

https://www.drupal.org/project/entity_reference_quantity would also solve this problem and contains far less code, but is less generic

dawehner’s picture

Conceptually IEF as a concept is a really powerful tool.

It not only enables the install profile, but also enables all kind of usecases:

  • Removes the requirement to write a custom field widget for media references, and enables in general all kind of media integrations
  • It enables in general complex content architecture models, which could help the content modelling initiative

On the other hand, I totally agree, its a complex beast. One maybe good approach in general would be to see how core could make that easier and then write a version of IEF, with improved core APIs.

bojanz’s picture

Forget about the IEF widgets for now.
Having an IEF form element would already be huge, and allow all kinds of use cases.
But for that to happen in a clean way we first need to introduce #element_submit to Form API.

So basically: #element_submit -> form element -> field_collection-like widget (row per reference with the form embedded).

jibran’s picture

introduce #element_submit to Form API

Do we have an issue for this?

dawehner’s picture

tkoleary’s picture

Issue summary: View changes
tkoleary’s picture

Title: Add inline entity form to core » Add inline entity form to core as experimental
phenaproxima’s picture

BIG +1 to this!

yoroy’s picture

Issue summary: View changes
Priority: Normal » Major
Related issues: +#2497361: [meta] Fix issues found during UMN Usability Testing 2015
matthieuscarset’s picture

+1000 to have IEF in core, even as experimental it would be a really smart move for Drupal.

geek-merlin’s picture

Frankly said, the IEF module itself has grown to a huge convoluted mess (i'm maintainer).
Bojanz took parts of it (only the most elementary functionality) and added them to Commerce core.

+1 for moving THAT into core (it's clean and as part of commerce, well-hung), and having the complex parts in a (say) IEF-NG module.
I have no time for that. But if someone chips in developer time, i may provide feedback and mentoring.

johnwebdev’s picture

+1 on the InlineForm API in core it’s slick and super clean.

ressa’s picture

Issue summary: View changes

Adding a link to the module, and updating number of installs.