Problem/Motivation
For a use case of mine I require the basic UI of the simple inline entity form widget provides, with the only addition that you are able to select between a few target bundles.
Proposed resolution
Allow the simple inline entity form widget to work with multiple target bundles by (if the field supports referencing multiple bundles) providing a dropdown in which you can choose the desired target bundle. The inline entity form is dynamically rendered based on the selection you make:

| Comment | File | Size | Author |
|---|---|---|---|
| #15 | interdiff_14-15.txt | 1.52 KB | rp7 |
| #15 | inline_entity_form-simple_widget_multiple_target_bundles-3200124-15.patch | 18.8 KB | rp7 |
| inline_entity_form_simple_multiple_bundles.gif | 1.92 MB | rp7 |
Issue fork inline_entity_form-3200124
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
rp7 commentedI wasn't sure if this should go in a contrib module or directly in the inline_entity_form module. I decided to go the inline_entity_form module for now & hear out your opinions.
The only doubt I have with the current solution is that it re-applies field values of fields with the same name when switching bundles. Could be a bonus? Unsure.
Merge request opened & attaching as a patch as well.
Comment #4
rp7 commentedComment #5
geek-merlinThanks raf for steppung up, doing this contribution, and making such a nice gif for it ;-). And test coverage, yay.
I like the feature a lot, but do't have the time today to do a thorough review. Stay tuned.
Comment #6
geek-merlin@rp7: I scanned the patch, and it looks like some of the changes are unrelated. Is this possible? Can you re-check?
Also, can you make an issue fork and push to it so we get gitlab review bliss? Thanks!
https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa...
Comment #7
rp7 commentedUpdated fork with latest commits in 8.x-1.x + removed the "container-inline" attribute (this was - unintended - copy/pasted from the complex widget).
@geek-merlin
Could you elaborate a little more? AFAICT every change is needed.
Comment #8
rp7 commentedI noticed an issue with the current implementation in combination with a multi-value field in the inline entity form (the "Add more" button didn't do anything). The active bundle not (always) being correctly derived was the culprit.
Comment #9
rp7 commentedComment #10
rp7 commentedMade a few minor improvements to the select-element for when the reference field is required.
Comment #11
giorgoskI have recreated the patch for latest dev version / 8.x-1.0-rc10 but because of #3270348: Regression from #2901158 this patch is mostly untested.
Comment #12
rp7 commentedRe-rolled against latest dev + fixed an issue where the bundle options weren't sorted by their weight (defined in
setting).
Comment #13
rp7 commentedRe-rolled against latest dev + fixed an issue with the incorrect label being used in the required error message.
Comment #14
rp7 commentedTypo in previous patched. Sorry for the noise.
Comment #15
rp7 commentedThe inline entity form input is now also reset when changing the bundle. This way default field values are correctly applied.