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,
- I have a 'Product' and it references a 'feature' as a multi-value field.
- 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
Comment #2
larowlanhttps://www.drupal.org/project/entity_reference_quantity would also solve this problem and contains far less code, but is less generic
Comment #3
dawehnerConceptually IEF as a concept is a really powerful tool.
It not only enables the install profile, but also enables all kind of usecases:
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.
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedForget 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).
Comment #5
jibranDo we have an issue for this?
Comment #6
dawehnerThis is certainly a good idea: #2820359: Add #element_submit and #limit_element_submit just like #element_validate and #limit_validation_errors
Comment #7
tkoleary CreditAttribution: tkoleary at Acquia commentedComment #8
tkoleary CreditAttribution: tkoleary at Acquia commentedComment #9
phenaproximaBIG +1 to this!
Comment #10
yoroy CreditAttribution: yoroy at Roy Scholten commentedComment #11
matthieuscarset CreditAttribution: matthieuscarset as a volunteer and commented+1000 to have IEF in core, even as experimental it would be a really smart move for Drupal.
Comment #12
geek-merlinFrankly 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.
Comment #13
johnwebdev CreditAttribution: johnwebdev commented+1 on the InlineForm API in core it’s slick and super clean.
Comment #14
ressa CreditAttribution: ressa at Ardea commentedAdding a link to the module, and updating number of installs.