When the Widget Inline entity form - Complex is used and no edits are made in the entities, they are not ordered by weight. This happens when using Layout builder and adding to it, custom blocks that have fields with this type of widget.
Issue fork inline_entity_form-3136514
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 #2
mmaldonado commentedComment #3
abarrioChanging to Needs review in order to launch tests
Comment #4
geek-merlinThanks for spotting this!
I am surprised this did not pop up earlier.
When i look at the patch, i wonder it this can make use of existing code.
Comment #5
mmaldonado commentedHello @geek-merlin,
Yes, there could be a code refactoring for the ordering of the weights.
Regards
Comment #6
joachim commentedEither I don't understand what this issue is about, or I'm not managing to reproduce it.
These were my steps:
1. Edit a host entity which has 2 entities in the IEF field
2. Drag to change the order of the nested entities
3. Save the host entity form.
4. Edited it again to see if the reordering had had an effect
It worked as expected -- my re-ordering changes had saved.
Could somebody expand on the issue summary and ideally add steps to reproduce please?
Comment #7
strykaizerI had the same issue, patch fixed the problem.
In my case, I have
- Custom entity as entity reference on a block_content entity
- Widget inline entity form complex
- Layout builder available per node
Weights were not being updated, after patch from #2, issue was gone
Thanks!
Comment #8
joachim commented@StryKaizer could you explain the precise steps to reproduce the problem please?
Comment #9
strykaizerSorry, for now I lack the time to test/document how to reproduce this on a vanilla environment.
Our project has following setup
- overrideable layout per node (layout builder)
- layout builder AT is enabled (not sure if necessary to reproduce)
- We have block_content entities, which have an entity_reference to custom coded entities. We place these block_content entities as a "custom block" using the layout builder.
- When editing a node's layout, form of the content_block entity is rendered with the complex IEF widget, in the front-end layoutbuilder, in a modal form.
When changing weights in that modal in the frontend, and saving, the weights are ignored without patch from #2
Comment #10
strykaizerAttached is a screencapture which shows how it works WITH patch.
Without the patch, the order of "Boek een onderhoud" and "Carrosserie" was not changed.
What you see is a node, and we alter a specific "custom block" from a specific "section" in layout builder.
Hope this helps? ;)
Feel free to contact me on slack if you need more help (Strykaizer)
Comment #11
geek-merlinComment #12
r_h-l commentedThis breaks rc9, due to Crypt no longer being loaded, and its replacement with a method. Attaching corrected patch
Comment #13
a3hill commentedPatch #12 worked for me with rc9.
Comment #14
geek-merlinGreat. Can we have a test for this?
Load, change weight columns, save, assert?
Comment #15
geek-merlinComment #16
nathandentzauPatch #12 worked for me IEF RC9 and Drupal 9.2. Thanks for the patch!
Comment #17
rajab natshah✅ Tested adding the 3136514-02.patch from patch from #12 to fix inline_entity_form-1.0-rc9 under Drupal 9.2.x
Thank you :)
Comment #18
artemboiko+1, 3136514-02.patch patch fixed problem on Drupal 9.2.7
Comment #19
couloir007 commentedThis patch has been around a while, any sense of when it'll make it into the module?
Comment #20
rajab natshahTested #12 with Inline Entity Form
2.0.0-beta3Comment #21
rajab natshahTested #12 with Inline Entity Form
2.0.0-beta6Comment #22
rajab natshahComment #24
podarok#12 is in
tnx
Comment #26
geek-merlinBulk reopen.
Comment #27
geek-merlinNeeds an automated test.
Comment #28
dcam commentedThis is a duplicate of #3033241: Cannot update the order weight using complex form widget. Both issues have patches with widely different solutions. We need to figure out which one to implement (if any). Both patches need tests. The less desirable solution's issue needs to be closed after granting credit to all contributors in the other issue.
Comment #29
dcam commentedAfter evaluating the two available solutions, my preference is to close this one. This patch adds more code to sort the references in the event no entity was changed. But that function already sorts the references toward the end. So this introduces a huge code and functionality duplication problem. What happens if or when sorting functionality needs to be updated or fixed? That's just asking for more bug reports.
Furthermore, the #3033241: Cannot update the order weight using complex form widget patch removes the code that causes the bug. This patch just works around it. Maybe the other patch isn't a complete solution yet, but I would rather start from that point than just add more code bloat to this module.
Comment #31
rajab natshahAttached a static
inline_entity_form--2024-12-27--3136514--mr-126.patchfile, from the MR126 up to this point.to be used with Composer Patches
Comment #32
rajab natshahAttached a static
inline_entity_form--2025-01-04--mr-126.patchfile, from the MR126 up to this point.to be used with Composer Patches