From time to time I'd like to create a display of a menu, usually for administrative purposes, that shows all menu items—even those that have been disabled. It would be most helpful to have a checkbox in a Menu Block's configuration to "Show disabled menu items".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BenPoole’s picture

+1 This would be very helpful in a sitemap or an admin area. In my case, just because I don't want a menu item displayed in the site's main navigation doesn't mean I don't want it in ANY menu or display.

pcavanaugh’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Active » Needs review
FileSize
3.53 KB

I needed this functionality so I created a patch (against 7.x-3.x). Attaching the patch to request inclusion in the next stable release…

TravisCarden’s picture

Status: Needs review » Reviewed & tested by the community

Nicely done, @pcavanaugh; it works great. Way to hit the ground running on Drupal.org! :)

brad.bulger’s picture

I tried adapting this patch for the 2.x branch, since that's what we're using. I had to go into the Advanced settings to toggle "Expand all children of this tree." to get everything to show up, after that it worked fine. Maybe this new setting should also be in the Advanced set?

brad.bulger’s picture

a reroll of the 2.x patch against current state of that branch, for anybody else who might still be back on this.

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/menu_block.module
@@ -799,7 +802,7 @@ function menu_block_tree_output(array &$tree, array $config = array()) {
+    if ($tree[$key]['link']['access'] && (!$tree[$key]['link']['hidden'] || $config['show_hidden_items'])) {

This code needs to assume existing/exported menu block configurations do not have this value set and not using !empty() will cause a PHP notice here.

brad.bulger’s picture

reroll of patch against current 2.x, plus added empty() calls to address issue in comment 6

visabhishek’s picture

Status: Needs work » Needs review

Changing status to Needs Review

dshields’s picture

This doesn't seem to work for menu blocks that are created as panel panes.

Pol’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, patch working flawlessly. Can't wait to see this in.

Pol’s picture

FYI, the patch has been applied to 7.x-2.7 but the issue if for 7.x-3.x, I guess the patch is also ok for 7.x-2.x then.

joelpittet’s picture

Status: Reviewed & tested by the community » Needs work

Putting back to needs work for #9 . @dshields can you provide more detail?

drumm’s picture

(Disregard - saving to fix some database inconsistency following an outage.)

dshields’s picture

Version: 7.x-3.x-dev » 8.x-1.x-dev
Status: Needs work » Needs review
FileSize
2.97 KB

Here's a patch for Drupal 8.

jacobbell84’s picture

Doing a quick re-roll for 1.10 and fixing an unused variable.

Nikhil_110’s picture

The above patch is applied successfully for Menu Block v8.x-1.x-dev.
Attaching the screenshot for reference.

Test Setps

  • Setup Drupal with Menu Block v8.x-1.x-dev
  • Enabled Menu Block and Go to Administration > Administration > Structure > Menus > Create menu and menu status is disabled.
  • Go to Administration > Administration > Structure > Block layout > Click the "Place block" button in the desired regionand Choose a block from the "Menus" category. In the form that appears, configure the Advanced options and enable tha Show hidden items from this tree. and then click the "Save block" button. CONFIGURING MENU BLOCKS
  • Go to Home page check disable menus.