When viewing a node which is both a Group node and group-content, og_context_handler_node() fails to identify the group the node is a member of as context, because it assumes that the node itself is the only possible context (because it is also a group).

The attached patch modifies _group_context_handler_entity() to merge both the group-node itself and any parent groups it is a member of, rather than simply ignoring the latter if a match is found for the former.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Yuri’s picture

Issue summary: View changes

Does anyone know if such a patch is available for the 7.x-2 version?

Yuri’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Yuri’s picture

Status: Needs review » Active
Yuri’s picture

FileSize
46.87 KB

This issue also appears when trying to create a view that lists all group content of the group in the current OG context.
Can someone please help me out with this?
Normally i use this view (panel pane) but that fetches the currently viewed group instead of its parent group.
og view

benjf’s picture

Here's a slightly different method - not sure which might be preferred.

ultimike’s picture

Should this result in "context-*" classes being added to the HTML body tag for both the child and parent groups?

For example, take the case of a site that has groups-within-groups, when a node belonging to the child group is displayed, instead of the body tag looking like

<body class="html not-front logged-in page-node context-child-group omega-mediaqueries-processed responsive-layout-wide">

it will look like the following (with the patch)?

<body class="html not-front logged-in page-node context-child-group context-parent-group omega-mediaqueries-processed responsive-layout-wide">

This is what I'm looking for. I'm using 7.x-2.x and the patch in comment 5 doesn't provide this. Am I understanding it correctly?

-mike

markdc’s picture

Thank you so, so, so much for this patch! I've spent an entire day trying to figure out how to get the sibling subgroups to show. Wish I would have found this sooner.

markdc’s picture

I've found a problem:
The base group context correctly remains when navigating the link structure downward (group > subgroup). When entering subgroup content, the context changes to the subgroup's. Here is where the problem arrises: when navigating upward (subgroup content > subgroup) or clicking the browser's back button, the subgroup context is now its own and not the base group's. This behaviour is inconsistent.

I'm not sure if it has to do with my views/panels setup. Any suggestions? Is it a problem with the patch? I'm using og_context-group-parent-contexts-1380818-5.patch.

@ultimike
No, this patch does not supply both contexts. But I suspect it is supposed but isn't properly doing so.