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 maintaining field_group_table and I'm having an issue that I can't seem to wrap my head around. I can't get nested Field Groups to work properly. Only the top level table works, and any fields in a nested group are rendered normally.
I'm currently implementing hook_field_group_pre_render(). Should I implement a different hook?
Comments
Comment #1
a.ross CreditAttribution: a.ross commentedI figured out what the issue was. Turns out that changing the hierarchy of groups causes it to break in unpredictable ways. what I had to do instead was to leave the group's children intact until rendering. So I had to implement a theme function to work around this issue.
Comment #2
alexweber CreditAttribution: alexweber commented@a.ross could you please elaborate? I think I'm having a similar issue: #1995738: Pre-renders called in wrong order in field_group_fields_nest()
Comment #3
a.ross CreditAttribution: a.ross commentedMy issue was the Field group Table module. Like I said, I was moving around the field groups in the render array hierarchy, which meant that the loop invoking pre render hooks for the groups in field_group_nest would fail.
Comment #4
a.ross CreditAttribution: a.ross commentedYour patch probably isn't correct and serves only as a workaround in your specific case. Have you considered a group hierarchy more than 2 levels deep for example?
Comment #5
alexweber CreditAttribution: alexweber commented@a.ross, yeah I'm aware that this is a stop-gap. I mostly uploaded the patch for use with my own makefiles :)
That said, this seems to be a common problem as per this comment.
What's the best way to work around this do you think?
Comment #6
a.ross CreditAttribution: a.ross commentedLet's continue discussion over at the other issue.