in previous versions of field_group if the fields contained were not editable - for example field permissions, the field group did not display during the content edit. after the update to 1.6 these field groups are now being displayed as empty field groups. for our case we're using vertical tabs with fields that have field permissions set to determine what roles can edit what fields - organized by the field_group vertical tabs.
this appears to be the result of the #2494385: Should #array_parents be updated in field_group_fields_nest()? patch. i have reverted this bit of code and the groups now behave as they did - not displayed unless the user has permission for a field contained within the field group. we rely on this behavior - probably because that's the way it has worked (and found a reference suggesting this approach 3+ years ago - #2153771: Field group visible based on Role / Permission? - so others may be depending upon this as a way to hide a group as well).
Comment | File | Size | Author |
---|---|---|---|
#13 | 2926605.patch | 885 bytes | drumm |
#2 | field_group-remove-array_parents-2494385-11.patch | 3.15 KB | travelvc |
Issue fork field_group-2926605
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
travelvc CreditAttribution: travelvc as a volunteer commentedI can confirm the same issue.
In my case, upgrading from 1.5 to 1.6 causes an erroneous tab to be displayed on my site registration page.
Reversing the patch in #2494385 that was included in the 1.6 update resolved the issue.
It looks like it's the new code in field_group_fields_nest() that is causing this.
I have attached a reverse patch in case anyone needs a quick fix.
Comment #3
sense-designPatch works for me too and removes empty groups.
Comment #4
gturnbull CreditAttribution: gturnbull as a volunteer commentedThis patch worked for me too. After updating from version 1.5 to 1.6, field groups with non editable fields became visible. This resulted in a field group of empty vertical tabs appearing in the middle of our online checkout page.
Great patch! Thank you!
Comment #5
smitty CreditAttribution: smitty commentedPatch works great! Thank you!
Comment #6
AnybodyI can confirm that the issue exists in 1.6 and latest dev, while it was correct in 1.5. I'll change the version to 7.x-1.x-dev and hope for this to be commited to dev soon.
I'll test further now.
Comment #7
AnybodyRTBC. The patch works perfectly and restores the correct behaviour from 1.5
Comment #9
AnybodyComment #10
jyraya CreditAttribution: jyraya commentedHello,
Fixing an issue by introducing a regression on another topic is just a workaround, but cannot be a definitive solution.
I put back the issue in "Needs work" waiting for a true fix that does not reintroduce the other issue.
I will work on this and hope coming back with a fix ASAP.
Comment #11
drummThis caused #3010210: Blank tabs on the registration page on Drupal.org.
Reverting and re-opening the original issue would certainly be an okay solution here, since #2494385: Should #array_parents be updated in field_group_fields_nest()? was a feature request that cleanly reverts. But that’s up to the maintainers.
Attached is a patch with a narrow fix for this. I’m not sure if it’s ideal, but it’s straightforward and I can’t see any side-effects.
count(element_children($element)) === 0
would be more simple, but might also lead to more side effects.field_group_pre_render()
is called.Comment #13
drummI’ve gotten out of the habit of using old array syntax.
Comment #14
ChrisDarke CreditAttribution: ChrisDarke at Hook 42 for Zicasso, Inc. commentedRTBC patch #13, does exactly what is needed.
Comment #15
John Pitcairn CreditAttribution: John Pitcairn commentedThis regression also affects fieldgroups added to commerce checkout panes by the commerce_fieldgroup_panes module. See #3093815: Vertical tab fieldgroups are rendered when disabled. The patch at #13 fixes it.
Comment #16
John Pitcairn CreditAttribution: John Pitcairn commentedComment #17
muaz91+1 for the patch in #13
Comment #18
PhilYPatch #13 works using Drupal 7.73, field_group 7.x-1.6 and PHP 7.2
Thanks
Comment #19
drummAs far as I’m aware, the patch has not had final review and committing.
“Patch (to be ported)” really means that that it needs backporting to an earlier release series, like 6.x-1.x.
Comment #20
PhilYI apologize for misunderstanding the meaning, thanks @drumm for checking and setting it back.
Comment #21
dmundraTested patch #13 and it worked for me as well.
Comment #22
anrikun CreditAttribution: anrikun commentedPatch at #13 works for me as well. Please commit.
Comment #23
claudioasaez CreditAttribution: claudioasaez commented+1 for the patch in #13
Comment #25
swentel CreditAttribution: swentel at eps & kaas commentedcommitted and pushed, thanks!
Comment #26
swentel CreditAttribution: swentel at eps & kaas commented