Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm not sure if this is just something on my site, or a bug in the module, but when I click 'Add new [entity]' in an IEF, the field name/label disappears until I either create the entity inline or click Cancel. Illustration below:
Comment | File | Size | Author |
---|---|---|---|
#28 | inline_entity_form-no_label_required_field_with_no_entries-2842744-27-D8.patch | 6.11 KB | sinn |
|
Comments
Comment #2
geerlingguy CreditAttribution: geerlingguy at Acquia commentedIf I inspect the source after IEF loads its form inline, I see there's an empty
<legend></legend>
for the new fieldset it adds in:Comment #3
filsterjisah CreditAttribution: filsterjisah for District09 commentedSame issue here. Only applies when the IEF field is required.
After having a closer in the InlineEntityFormComplex class:
This is where the add form gets rendered (shown by default if the field is required) (1):
The wrapper fieldset loses its label when this field has no existing entities yet (2):
What if we change the element type from fieldset to container for (1) and remove the no-entities-added case (2)? This would remove the visible fieldset around the inline entity add form, but would maintain the IEF its label all the time.
Comment #4
filsterjisah CreditAttribution: filsterjisah for District09 commentedComment #5
filsterjisah CreditAttribution: filsterjisah for District09 commentedComment #6
Alex Bukach CreditAttribution: Alex Bukach commented#4 works fine for me. Thanks!
Comment #7
jeffschulerYes... when I changed my IEF to Required, the field label disappeared.
Patch in #4 is working for me, too.
Oddly, duplicate titles are shown when the "Simple" version of the form field is displayed. I'm curious why this code is in the the InlineEntityFormComplex.php instead of InlineEntityFormSimple.php.
Comment #8
andrey.troeglazov CreditAttribution: andrey.troeglazov at DrupalJedi commentedHello,
The #4 patch applied correctly and working as expected.
+1 for RTBC.
Tested on dev branch.
Simple form works ok for me.
Comment #9
andrey.troeglazov CreditAttribution: andrey.troeglazov at DrupalJedi commentedComment #10
jonathanshawI wonder if removing the fieldset has negative accessibility implications. Still, losing the label is even worse ...
Comment #11
ShermanIO CreditAttribution: ShermanIO as a volunteer and commentedThe Patch 4# works perfectly for me!
Comment #12
HumbertoJZG CreditAttribution: HumbertoJZG commentedThe patch #4 doesn't work for me.
Comment #13
HumbertoJZG CreditAttribution: HumbertoJZG as a volunteer commentedComment #14
HumbertoJZG CreditAttribution: HumbertoJZG as a volunteer commentedThe patch #4 doesn't work for me because i have multiple values in the field IEF.
When i tried add something from the list, the name disapear from the legend of the fieldset.
Comment #15
joachim CreditAttribution: joachim commentedSetting to needs work based on #14.
Comment #16
HumbertoJZG CreditAttribution: HumbertoJZG as a volunteer commentedI found the solution that i looking for, but i don't know how to up the changes.
Comment #17
jonathanshaw@HumbertoJZG it would really help if you could explain precise steps to reproduce the problem, and say what solution you found.
Comment #18
HumbertoJZG CreditAttribution: HumbertoJZG as a volunteer commentedI have multiple values in the inline_entity_form_complex field, when i pick one, i see the form. But the field/name for the legend desapear.
Then check if there was an open form, and pass the title of the type of referenced content I want to show.
After to applying my changes, i can see the field/name for the legend. work for me.
Comment #19
joachim CreditAttribution: joachim commentedI meant to set this to NW in my last comment...
Comment #20
geek-merlinThanks a lot for debugging this!
To me it looks like #3/#4 spots the code to look into, but adds the wrong solution. This must be fixed without changing existing markup (except for the buggy ;-). Let's find the right condition for the "Remove the outer fieldset" part, maybe involving
$open_form
.Comment #21
andyg5000In my case, the code below changes the wrapper element from a "details" to a "container". This causes the parent field (invoking IEF) to lose it's title and description (see keep/removed screenshots). In my instance I want to keep all this stuff, but maybe things like commerce want it removed.
Line 577:
Comment #22
sinn CreditAttribution: sinn as a volunteer commented#4 works for me even for multiple values field. From comments #14, #16, #18 I have not understood what is wrong and alternative solution wasn't provided.
Comment #23
sinn CreditAttribution: sinn as a volunteer commentedIssue is in the code:
From the history I see that this code is from D7 version. There isn't fieldset wrapper in D8 version. $element['#type'] == 'details' now. There is a difference how collapsible elements work in D7 and D8 - https://www.drupal.org/node/1852020. I have not found "visual noise caused by having two titles" after removing this code.
After applying patch #23 additional border is shown in comparing with solution #4 but might be this solution is more consistent based on the implementation of the form in another cases and #20.
Comment #24
jonathanshawThis seems like the right approach to me.
Comment #25
joevagyok CreditAttribution: joevagyok commentedGood job with #23, looks good and it works.
However, this should be tested. @sinn, please extend the ComplexWidgetTest to check for the presence of this element and the title.
Comment #26
sinn CreditAttribution: sinn as a volunteer commentedTest that shows the issue is attached.
Comment #28
sinn CreditAttribution: sinn as a volunteer commentedTest with solution is attached.
Comment #29
jonathanshawLooks good to me, thanks @sinn!
Comment #30
Andras_Szilagyi CreditAttribution: Andras_Szilagyi at Randstad Digital for European Commission and European Union Institutions, Agencies and Bodies commentedTested, works for me
Comment #31
joevagyok CreditAttribution: joevagyok commentedReviewed and tested, thanks @sinn!
Comment #32
Ollie222 CreditAttribution: Ollie222 commentedThat looks to solve the problem for me too, thanks @sinn
Comment #33
joachim CreditAttribution: joachim commented> To me it looks like #3/#4 spots the code to look into, but adds the wrong solution. This must be fixed without changing existing markup (except for the buggy ;-). Let's find the right condition for the "Remove the outer fieldset" part, maybe involving $open_form.
I think what @geek-merlin means here is that it feels a bit iffy to just remove this chunk of code without understanding what it was trying to do.
> // No entities have been added. Remove the outer fieldset to reduce
> // visual noise caused by having two titles.
When would two titles be shown?
The patch works for me on the complex widget, but I'm wary of committing it in case it breaks something we've not considered.
Comment #34
jonathanshaw#23 attempts to answer these questions and explain the history. Can you say in what way it is insufficient.?
Comment #35
joachim CreditAttribution: joachim as a volunteer commented> Can you say in what way it is insufficient?
In the 'co-maintainer was multi-tasking while using this module on a work project and didn't read all of the comments' way ;)
I'll commit this when I have a moment.
Thank you for the explanation.
Comment #37
joachim CreditAttribution: joachim commentedCommitted.
Thanks to everyone who's worked on this issue.