Group Menu not visible on Node pages

Created on 9 September 2020, about 4 years ago
Updated 15 August 2024, 3 months ago

Problem/Motivation

There are two things to this issue;

  • If a group menu is placed in a region and a node is part of the group as well as group menu-item; the group menu is not visible on node page. There is context missing for node pages that are part of groups and menu trail.
  • (This has been provided by Integrate some of Menu Block module's options Fixed )

Steps to reproduce

add a node to a group and also to group's menu; place the group menu on block region. goto node page and that group menu is not visible.

Proposed resolution

a patch is created to do two things;

  • Provide a group context for node entity pages which are part of group and menu trail.
  • (see above)
📌 Task
Status

Closed: works as designed

Version

3.0

Component

Code

Created by

🇵🇰Pakistan Qandeel Islamabad, Pakistan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇮Finland thatguy

    Re-rolled patch from #11 to work with dev-3.0.x version. I also needed the patch from https://www.drupal.org/project/group/issues/2815971#comment-14881532 📌 More contexts needed Needs work to get the Group content menu to show correctly on node pages which belong to a Group.

  • 🇫🇮Finland thatguy

    Re-rolled #12 to work with latest 3.x-dev version

  • 🇮🇳India pradeepjha

    We need to make patch compatible with latest version of this module.

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    6 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    6 pass
  • 🇮🇳India pradeepjha

    Applied some early check and updated patch.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    2 fail
  • 🇺🇸United States zipymonkey Durham, NH

    Patch does not for 3.0.x branch so I rerolled it and add node context to the block instead of loading the node from the request.

  • The last submitted patch, 18: group_content_menu-menu-not-visible-3.0.x-3170013-18.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & sqlite-3.27
    last update over 1 year ago
    6 pass
  • Status changed to Needs work over 1 year ago
  • heddn Nicaragua

    Can we split this issue into 2 parts please? And see comments in #5 and #6.

  • 🇺🇸United States emerham

    @heddn I'm not seeing the concern from #6 in any patch after #11. Do you want us to update the Issue?
    Also without this patch I do have some theme suggestions provided

    • menu--group-menu.html.twig
    • menu--group-menu--<group content menu machine name>.html.twig

    I feel like we don't need to provide anything more for the suggestions and theme authors can use hook_theme_suggestions_menu_alter to provide more.

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    6 pass
  • heddn Nicaragua

    This refactors the code a bit more. But honestly, not a lot. If you have some special logic on finding the "current group", you should extend or create your own context plugin.

    Something like:

      my_module.group_context:
        class: Drupal\my_module\Context\GroupContext
        public: false
        decorates: group.group_route_context
        decoration_priority: 3
    

    Then you can add any and all of your special logic in there. The menu might not be the only place that you need to know this information. This module makes no assumption that a site is even using nodes for group content. If you want to resurrect that logic from a patch here, throw it into a custom module.

    For those that don't want to do the custom group context just mentioned, I've added a helper method ::getGroup()for getting the "current group". You can alter the block definition to use a custom block that extends the current class. In that extension, you can just add your group logic. You'll also want to add any cache context appropriate at the same time to ::getCacheContexts(). But creating your own context plugin is probably easier.

    And I've also tagged this as a task. There's no bug here.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 7 months ago
    Patch Failed to Apply
  • patch #17 📌 Group Menu not visible on Node pages Needs review worked but getting an exception

    Uncaught PHP Exception Error: "Class "Drupal\group\Entity\GroupContent" not found" at \modules\contrib\group_content_menu\src\Plugin\Block\GroupMenuBlock.php line 343
    I fixed the issue by calling the `GroupRelationship` class, see update #23 patch

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 7 months ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & sqlite-3.27
    last update 7 months ago
    Patch Failed to Apply
  • 🇳🇱Netherlands florisg

    Thank you @shalDrupal this patch rolls out right for me.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    6 pass
  • sorry ignore my last patch #23 and used attached corrected patch.

  • 🇨🇦Canada JayDarnell Guelph, Ontario

    Patch #26 seems to work well for group_content_menu 3.0.1, group 3.2.2, and drupal 10.2.5

  • 🇳🇱Netherlands florisg

    Rerolled #26 against 3.0.3 (July 4 2024)

  • Status changed to Needs work 4 months ago
  • 🇳🇱Netherlands florisg

    menu is again not showing even after CR and permission rebuild.

  • 🇺🇸United States daletrexel Minnesota, USA

    Updating version to prioritize issue fork off of 3.x branch.

    Also updating issue description to acknowledge that Integrate some of Menu Block module's options Fixed has added template theme suggestions.

  • Pipeline finished with Failed
    4 months ago
    Total: 1630s
    #236897
  • Pipeline finished with Success
    4 months ago
    #236910
  • Pipeline finished with Success
    4 months ago
    Total: 212s
    #237929
  • 🇺🇸United States daletrexel Minnesota, USA

    DaleTrexel changed the visibility of the branch 3170013-2x-group-menu-context to hidden.

  • Pipeline finished with Success
    4 months ago
    Total: 214s
    #238928
  • Status changed to Needs review 4 months ago
  • 🇺🇸United States daletrexel Minnesota, USA

    Setting this to Needs Review to get some more eyes on it. Would love to get some feedback!

    Have been working on a minimal Drupal setup. Will be checking on a copy of the main site that I manage next (2.x).

  • 🇺🇸United States daletrexel Minnesota, USA

    Adding 🐛 Starting level deeper than 1 ignores active trail, when "Expand all items" is enabled Needs work as related, where MRs merged with MRs from this issue are available as a single branch, for review and patching purposes.

  • 🇨🇦Canada JayDarnell Guelph, Ontario

    The patch DaleTrexel supplied in merge request 27 appears to fix the issue for group_content_menu 3.0.3 branch on Drupal 10.3.1. I'll continue testing but so far so good.

  • 🇨🇦Canada JayDarnell Guelph, Ontario

    One caveat I'm running into with DaleTrexel's patch is that I cannot get the menu to show up on the group itself unless I leave the settings for the menu block to completely unrestricted. The moment I restrict the content types to 1 of the allowed types within the group (In my case I only want the menu to show on pages in the group, not news items in the group) the menu no longer shows on the group itself, even if I explicitly specify the group type.

  • 🇺🇸United States daletrexel Minnesota, USA

    JayDarnell: Is this something that you had working before on previous versions of this module, or is it new?

    I have been unable to replicate what you describe: make a Group Content Menu appear on a Group page after checking to restrict the menu block to one or more of the content types in its configuration. I've tried various combinations of Group 3.2.* with and without patches from 📌 More contexts needed Needs work , and Group Content Menu 3.0.* with and without patches from this issue. I'm also currently running Drupal 10.2.8-dev on my test site. In all my tests, as soon as you restrict by content type (even if you check all available types) the menu appears on the Group page.

    If you were able to get GCM to appear on a Group page when using the block content type restriction setting enabled, please share the versions of Group and GCM, plus patches applied! I'd definitely like to see what's going on.

    But if this is something new that you've discovered, then it should be reported as a separate issue.

    (In my own testing previously, I was never able to figure out how one might use the Content Type restrictions settings OR the two confusing "Group Types" and "Group Type" settings tabs on the menu block, so I wouldn't be surprised if you've found something no one else has tried and/or reported yet.)

  • Status changed to Closed: works as designed 3 months ago
  • heddn Nicaragua

    The group context you need here is what you should be using. group.module provides a context. Use it or extend it it to provide your own group context special rules. But this module is not going to land something that is provided already by group.module.

  • 🇨🇦Canada JayDarnell Guelph, Ontario

    daletrexel - this is my first time using this module and its for a brand new build. When I started the build back in February we were using older versions of core and this module and it seemed to work fine, though to be fair I only did a cursory check as the group functionality was not priority at the time.

    Now I'm on the following setup:

    • Drupal 10.3.1
    • Group 3.2.2
    • Group Content Menu 3.0.3

    I'll do more testing today to see if I can figure out what is going on. To restate my issue, I want the menu to display on the group itself and any nodes of type "Lab Page" within the group (but nothing else: no other content types, not user entities within the group, etc) I would think all I have to do to restrict this is check the appropriate boxes when I add the group_content_menu block to a given region but that doesn't seem to be the case.

    @heddn, just to be sure I follow, are you saying the intended behavior of this module is to automatically display the group_content_menu block in a given region based on group context alone, with no considerations for block visibility settings and that to specify more specific visibility settings I would need to write code to extend the context provided by the group module itself?

Production build 0.71.5 2024