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.
Recently came across a scenario where I wanted to use some values from the parent group of a node in a panel and was unable to load the parent group as a context. The solution seems to be implementing a plugin for ctools. I'm not sure which plugin yet but I am going to look into this over the next few days and see if I can find the solution.
This is the area I'm talking about. Specifically creating a "Group from Node" relationship like there is a "User from Node" relationship.
Comment | File | Size | Author |
---|---|---|---|
group-panels-relationship.png | 64.82 KB | ctrlADel |
Comments
Comment #2
kristiaanvandeneyndeHeh, that's weird I thought I had already added that but it's indeed missing.
It should be easy to create, though: Check if the context entities are group enabled, if so: generate a relationship for it: "Parent group of Node", "Parent group of Group", etc.
I may have written my own in a previous client project and not remembered to add it into group :(
Comment #3
DerTobi75 CreditAttribution: DerTobi75 commentedHi there,
any chance, such a feature makes it into one of the next releases?
I need to show a mini panel withe the group name a node belongs to.
Best regards,
Tobi
Comment #4
kristiaanvandeneyndeHi Tobi!
I can certainly appreciate the need for this functionality, so I've added it to #2694173: [meta] 7.x-1.0 release roadmap.
This should be 30 minutes work tops, but I currently can't invest that amount of time while there are more critical D7 and D8 issues. Adding it to the roadmap will prevent it from being forgotten and perhaps give it the visibility it needs for someone else to pick it up.
Comment #5
maxplus CreditAttribution: maxplus commentedYes,
having a real group context inside panels would be great.
Now we only have the "Parent Group" from the node that only makes the group title available to panels, not the gid.
Having the gid would be much better (and all the other group variables)
Comment #6
Oscartt CreditAttribution: Oscartt commented+1 for this feature, desperately needing it for my project. Will try to make it myself, but not sure if I can make it work..
EDIT: Creating a proper CTools relationship plugin for this was a little out of my leaque, but I was able to come up with an alternative solution. So let's assume we are creating a node template in Panels, and we want to pull in the parent group of the node being viewed, in order to show group join/leave buttons and other group data. This is how I got it to work:
1. Create the node template in Panels that you wish to do this in. In my case, I created a variant with selection rules: Node being viewed is type "Group Topic"
2. Go to the Contexts settings. In Relationships, select: "Entity property or field (via Entity Metadata Wrapper)"
Settings for that:
Entity: Node being viewed
Identifier: Just the title, can be anything. I set it to 'Parent Group from Node.'
Keyword: group
Data selector: group
Concatenator: Left it at 'And'
That's it! Now you can pull in all the group related data to your node template :) Btw, thank you kristiaan for this awesome module!
Comment #7
Soul88We thank everyone for their collaboration on this issue, but as the D7 version is no longer supported, we will now close all D7 issues to keep the issue queue a bit tidier. This information won't go anywhere, it just won't show up on the list of open issues anymore.
Please see: https://www.drupal.org/project/group/issues/3163655 and https://www.drupal.org/project/group/issues/3203863#comment-14100281 for more details.