Problem/Motivation
After I applied this patch menu block is correctly shown on both group page and pages of nodes (of a specific bundle) related to the group.
I placed this block on the sidebar first region of my theme. So far so good.
But at this stage the block will be loaded on any page of my website where I have the sidebar first region. Obviously the block is "empty", there is no menu inside. This because, to make the block correctly working on any group page, I needed to leave empty "visibility" configuration. I don't know if I'm doing something wrong with this module...
Steps to reproduce
- install module
- create a group menu type and enable it on the group you need
- create a menu content and add two links: one that linking the group page and the other one linking a node created in that group
- place the group menu type block on a region, selecting the value "Group from URL"; do not configure visibility
- look at the group page: the menu block should be correctly shown. Click on the other link: the menu block should be correctly show too.
- look at any other page that prints that region and you should see the block rendered inside of it but with no menu loaded.
Proposed resolution
Add a `blockAccess` protected function in the `GroupMenuBlock` class, allowing results only if the `menu instance` is !== NULL. Or something like that.
Remaining tasks
n/a
User interface changes
n/a
API changes
n/a
Data model changes
n/a
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | group_content_menu-block_always_rendered_even_without_menu-3178459-5.patch | 709 bytes | chrissnyder |
| #3 | group_content_menu_block_always_rendered_all_pages-3178459.patch | 1.09 KB | g0blin79 |
Comments
Comment #2
g0blin79 commentedThis simple patch works for me.
As proposed I added a simple blockAccess logic.
Comment #3
g0blin79 commentedSorry I made a mistake...this is the right patch.
Comment #4
heddnThis seems like a regression to #3170013: Group Menu not visible on Node pages that should be fixed over there. Closing duplicate.
Comment #5
chrissnyderI ran into a very similar issue. It seems like the block renders even if there is no group menu to display. The attached patch corrects the issue by returning an empty array as documented in the block API if we are not able to determine which menu to display.
Comment #7
heddnThanks for your contributions and good explanation of what is happening.