Problem

This request is a direct response to this issue that arose in UMN 2015 #2497361: [meta] Fix issues found during UMN Usability Testing 2015:

"Order of operations are backwards! For example, dependencies and prerequisites for structuring taxonomy/content/etc. are reverse from the way users conceptualize it. (e.g. creating terms before adding a field for terms) "

This quote is indicative of a "bottom up" pattern throughout Drupal. Once a structured content model has been created it should introspect it's own structure so that it's invisible to the end user. Drupal does not currently do this.

Proposed Solution

Add Inline Entity Form functionality to core (possibly but not necessarily the module, just the functionality)

Example

Inline entity form would enable site-builders to create experiences in which the user would not have to leave the content creation flow to create referenced sub-entities.

Where now a user on a music site might:

  1. create content of type "Album"
  2. save that content
  3. create content of type "Song"
  4. save that content
  5. create N other songs
  6. save those
  7. create content of type "Artist"
  8. Save that content
  9. edit song and add the artist
  10. repeat for each song
  11. edit the album and add all the songs

With inline entity form they would:

  1. Create an album
  2. In the same form create N songs and add the artist to each song
  3. save

Comments

tkoleary created an issue. See original summary.

tkoleary’s picture

Issue summary: View changes
tkoleary’s picture

Issue summary: View changes

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

colan’s picture

Component: field system » entity_reference.module

I've got an idea that should do the trick, without dealing with all of widgets, modals and whatnot provided by the combination of Entity Browser and Inline Entity Form. (I'm ignoring the other option, Entity Connect, because it's not very popular. However, feel free to raise that as an option if it has a good design, etc.)

Given that core now provides the "Create referenced entities if they don't already exist" option when creating an entity reference field, which summarily creates the referenced entity (at least with the Autocomplete widget), why can't we simply redirect to the new entity edit form after saving the referencing form? The problem is that there's no opportunity to edit the reference during creation, but so what? It can be edited after the original form is saved.

To handle recursion, we can simply add entity forms to the queue. After each form is saved, the next one pops off the queue to be edited by a redirect when saving the previous form. Once all have been edited, we can finally redirect back to the original entity's page, which would happen normally.

This keeps things nice and simple, and doesn't introduce any accessibility problems with modals, etc.

We should probably add a checkbox in the field config to determine whether folks want to use this feature or not, which could exist alongside the "Create referenced entities if they don't already exist" checkbox. Directly below would probably make the most sense, but greyed out if the other one isn't checked:

  • Redirect to newly created referenced entity forms for editing after entity form is saved?

If left unchecked, nothing would change from the current behaviour.

Thoughts?

colan’s picture

Title: Add Inline Entity Form functionality to Drupal core » Allow entities to be edited when created by reference

More generic title.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

colan’s picture

colan’s picture

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

matsbla’s picture

Maybe we could have something similar as the widget provided by Media Library in core.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.