
The Left and Middle divs do not show up when the entity is viewed in this display mode.
When I change the field widget from "Link" to "Html Element", they are rendered correctly.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | other_fieldgroups-2774599-8.patch | 2.05 KB | leon kessler |
| #2 | Manage_display_2.png | 41.05 KB | Algeron |
| Manage_display.png | 33.54 KB | Algeron |
Comments
Comment #2
Algeron commentedIt seems to be related to this code snippet in/src/Plugin/field_group/FieldGroupFormatter/Link.php:
A workaround is to add an additional fieldgroup right below the Link fieldgroup:

This makes child fieldgroups render correctly inside a Link fieldgroup.
Comment #3
leon kessler commentedHmmm this is quite a tricky one.
It actually makes sense that nested field groups are not rendered, as we're just passing everything into the Link class
#titleattribute (which I guess does not know how to render field groups).But what's weird is that double nested field groups do work. Why that is I do not know.
I tried removing the
hide()to see if that made a difference, still no joy.I also tried adding in my own dummy field group, like this:
Again, no joy.
If I can work how it's able to render these double nested field groups then I think it will be an easy fix.
Comment #4
henrijs.seso commented[deleted, wrong version]
Comment #5
leon kessler commentedOkay think I've finally found a fix. And it's a pretty simple one.
Incidentally I discovered another issue with nested field groups whereby they are not hidden. I created a separate issue for this: #2827745: Nested field groups are not hidden
I'm marking this as needs review while I do some more testing and ensure both tickets can be closed.
Comment #6
leon kessler commentedAssigning the group by reference doesn't quite work, because
hide($element[$group_child]);will now hide the field group inside the link as well.
Either need a way to only hide the field group outside of the link (this might need some kind of alter hook). Or actually work out the outer most field group doesn't get it's settings properly assigned.
Comment #7
leon kessler commentedOkay I think the best solution is to create our own Render Element, that extends the standard Link one. Then we can remove the children, at which point they've already been generated inside the $element['#title'].
Pretty confident with this solution, but will leave this for review will I check further. Also need to start looking at adding some unit tests.
Comment #8
leon kessler commentedBetter docblock commenting on class.
Comment #10
leon kessler commentedPushed to 8.x-1.x, and created 8.x-1.0-rc1 release.