When using a block (menu_block) to render the menu, the menu preprocess hooks are never called. Instead of using multiple menu hooks to handle the visibility logic for menu items, can we use the MenuLinkTreeManipulator instead?

See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21De...

It's a big refactor, but in doing so the module will become much more flexible.

See https://github.com/tableau-mkt/menu_link_content_visibility/pull/1/files for the proposed diff. Happy to discuss more.

Comments

Etroid created an issue. See original summary.

b2f’s picture

+1

Why don't you provide a standard patch so that it can be apply on any composer installation ?

@see https://www.drupal.org/node/707484

b2f’s picture

Status: Active » Needs review
StatusFileSize
new30.59 KB

Here is a patch extracted from the github branch, credits to Etroid.

git diff remotes/do/8.x-1.x remotes/origin/linktreemanipulator > does-not-work-with-menu-block-3082834-3.patch

etroid’s picture

Thanks @B2F

b2f’s picture

Here is an updated patch, there was a problem with the info.yml core section

bceyssens’s picture

When using the menu_link_content_visibility module in combination with the google_tag version 1.3 and saving menu items, the menu items will become invisible. This patch solves that issue.

I'm not sure if this issue is caused by menu_link_content_visibility or google_tag.

aspilicious’s picture

Status: Needs review » Fixed

I committed this in a new branch.
There were some issues with the gtag module so I had to special case them :(
https://git.drupalcode.org/project/menu_link_content_visibility/-/tree/2.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.