Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have so many active modules that the "Site Configuration" dropdown menu extends beyond the height of my screen. Recently, I went through and disabled a bunch of menu items under admin/settings/ that are basically "set once and forget" items. I figured it would be nice to hide them from admin_menu as well as from the navigation menu. Doing so was harder than I would have figured, though.
Anyhow, here is a patch against today's 6.x-1.x-dev version. Works for me; your mileage may vary.
Comment | File | Size | Author |
---|---|---|---|
#45 | admin_menu.custom-disabled.45.patch | 4.98 KB | sun |
#42 | hide-disabled-menu-tiems-282775-42.patch | 3.88 KB | pillarsdotnet |
#37 | remove_disabled_links_from_menu-282775-37.patch | 4 KB | jenlampton |
#32 | admin_menu.disabled.28.patch | 4.43 KB | pillarsdotnet |
#29 | admin_menu.disabled.28.patch | 4.43 KB | pillarsdotnet |
Comments
Comment #1
sunerm... and where are those items set to hidden?
Comment #2
pillarsdotnet CreditAttribution: pillarsdotnet commentedAfter applying the patch, they are hidden when I go to the admin/build/menu-customize/navigation page and uncheck the "Enabled" checkbox for those menu items that I don't want to see.
Tell ya what; I'm gonna mark this one "won't fix" because I stopped using the admin-menu (for performance reasons) and nobody else appears to be interested.
Comment #3
sunOk, but could you please elaborate on
? Is there something special in 6.x I'm not yet aware of?Comment #4
brei9000 CreditAttribution: brei9000 commentedSuccessful patch. Thank you!
Comment #5
stoptime CreditAttribution: stoptime commentedYes, thanks!
Comment #6
hansrossel CreditAttribution: hansrossel commentedWorks nicely, thanks!
Comment #7
hansrossel CreditAttribution: hansrossel commentedSetting back to needs review, could be good if this gets into the module. Admin menu is very handy but often it's interesting to hide certain menu items (like not to be used content types eg content profile, ...).
Comment #8
RikiB CreditAttribution: RikiB commentedIs there any hope in getting a patch for 3x?
Comment #9
sunI don't think that this is the right approach. If you want to hide links, then you shouldn't grant access to them. In the case of content types, you can configure access permissions very granularly per role, for example. Same applies to everything else.
Links that have been customized to be hidden should already be excluded in 3.x.
Comment #10
PeteS CreditAttribution: PeteS commentedYou can't think of any good reasons why an item would be placed in the menu, but disabled? Breadcrumbs. Pathauto. There are a million things that make use of the menu structure, where you don't actually want a menu item to show up in the actual menu.
I think the more important question is, can you think of a case where someone would intentionally disable a menu item, but still want it to show up in the administration menu?
Comment #11
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedI've made small patch to implement this. Be sure to clear site cache after disabling menu items. Patch was made from latest CVS code at the moment.
Comment #12
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedComment #14
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedThis is strange, I can't reproduce tests failure on clean local site with latest Drupal 6 from CVS, SimpleTest 6.x-2.10 and latest Administration menu from CVS. Described configuration with last patch passes all 48 tests. Am I doing something wrong?
Comment #15
jackalope CreditAttribution: jackalope commented#11: admin_menu-6.x-3.x-hidden-items.patch queued for re-testing.
Comment #16
jackalope CreditAttribution: jackalope commentedThe patch in #11 works for me, and is much needed! Not sure what's going on with the tests, though.
Comment #17
Passer CreditAttribution: Passer commentedadmin_menu.admin_menu.module.hide-disabled.patch queued for re-testing.
Comment #18
Passer CreditAttribution: Passer commented#11: admin_menu-6.x-3.x-hidden-items.patch queued for re-testing.
Comment #19
Passer CreditAttribution: Passer commentedI guess the main problem is that that the regular menu entires are copied and reorganized from admin menu.
Not the user-build menus preferences were used, but the modul given. So no hidden attributes are set in the database
Comment #20
crutch CreditAttribution: crutch commentedThank you #11
Comment #21
sunI didn't test, but I'm pretty sure that this also removes all local tasks from the menu.
Powered by Dreditor.
Comment #22
webster. CreditAttribution: webster. commentedI was able to reproduce the issue that the original submitter had. I have tested the patch in comment #11 and it worked as expected.
Firefox-3.6.13
Drupal-6.20
Postgresql-8.4
Admin menu-6.x-3.0-alpha4
Comment #23
ashmiler CreditAttribution: ashmiler commentedI have also used the patch in comment #11 and it has worked as expected. I am running Drupal 6.20 on Firefox 3.6.13
Postgres 8.4
Admin menu: Version 6.x-3.0-alpha4
Comment #24
pree93 CreditAttribution: pree93 commentedI have also used the patch in comment number 11, admin_menu-6.x-3.x-hidden-items.patch, and I found that it did what I expected it to do.
I used the following:
Mozilla Firefox 2.6.13
Drupal 6.20
Postgresql 8.4
admin_menu-6.x-3.0-alpha4
Comment #25
serenecloud CreditAttribution: serenecloud commentedI've been guiding some students through testing this patch. We used the latest 6.x-3.0-alpha4 rather than CVS on Drupal 6.20 (I had Postgres 8.1 running for it). Patch #11 worked well for us, I think it's also a possible workaround for the long menus bug: http://drupal.org/node/687750
Comment #26
chrisfromredfinInterested in this ticket. I used OP's patch on 1.6 and it worked, and looked at the (rather simple) patch for 3.x-dev. Both seem good. Setting to reviewed & tested by the community to see if we can get a commit.
Comment #27
pillarsdotnet CreditAttribution: pillarsdotnet commentedBe sure to also apply the patch from http://drupal.org/node/511804#comment-3989706
Comment #28
sunTested manually, custom links don't work (at all) for me in D6. But well, that's a horrible mess anyway.
Unfortunately, the same issue seems to exist in D7, too. Attached patch adds tests that prove the bug exists (in a rudimentary form).
Comment #29
pillarsdotnet CreditAttribution: pillarsdotnet commentedRe-uploading -- maybe the testbot has been fixed?
Comment #30
sugreenThis works for me:
module version: 7.x-3.0-rc1
file: admin_menu.inc
row: 369
added: || $data['link']['hidden'] == 1
if (!$data['link']['access'] || $data['link']['type'] == MENU_CALLBACK || $data['link']['hidden'] == 1) {
hidden may be 0,1,-1
Comment #31
pillarsdotnet CreditAttribution: pillarsdotnet commentedHmm.. I remember Randy Fay saying that the way to un-block such a request is to set the issue to "needs work" then back to "needs review".
Comment #32
pillarsdotnet CreditAttribution: pillarsdotnet commentedAnd re-re-uploading...
Comment #33
drasgardian CreditAttribution: drasgardian commentedThe solution in #30 worked for me against latest 7.x-3.x-dev (although the line number for the change is now 381)
Comment #34
hanoiiPatch in #11 works just fine for D6 and I think it should really be included. @sun, as said on #24, this doesn't prevent local tasks from appearing on the admin menu.
Comment #35
jenlamptonPatch no longer applies to dev brach :(
Comment #36
sunThis hunk is already part of #1097312: "Tasks" and "Index" links appear on the top-level and should be removed from this patch.
Comment #37
jenlamptonokay, patch re-rolled for latest dev. Added the fix from #30 and removed the line as per #36.
Comment #38
YesCT CreditAttribution: YesCT commentedthis will be super nice. for D6, should I retest #11, or wait to see if it gets committed for D7?
Comment #40
aaron CreditAttribution: aaron commented#37: remove_disabled_links_from_menu-282775-37.patch queued for re-testing.
Comment #42
pillarsdotnet CreditAttribution: pillarsdotnet commentedRe-rolled.
Comment #44
pillarsdotnet CreditAttribution: pillarsdotnet commentedTest needs to be rewritten, I suppose.
Comment #45
sunThanks for re-rolling.
Attached patch fixes the code and tests. Took over some code from #742184: Shortcut.module integration.
Comment #46
sunThanks for reporting, reviewing, and testing! Committed to 7.x-3.x and 8.x-3.x.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.
This fix will no be backported to 6.x-3.x.
Comment #48
hixster CreditAttribution: hixster commentedJust installed 7.x-3.dev (March 9th 2012) today. I have disabled a bunch of menus in the structure section of navigation menu as I don't want authenticated users to see menus we don't want them to see.
I ran update, I have flushed all caches but the menu items still appear?
Comment #49
sunThe expected behavior is backed up with automated tests, so something else must be wrong regarding #48.
Re-closing this issue.
Comment #50
hixster CreditAttribution: hixster commentedSorry to re-open, but just need to double check this.
I made a clean install to eliminate module clashes.
I can hide the majority of disabled menu items, but can not hide disabled items which are children of admin/structure/menu - is this the expected behaviour?
Comment #51
pillarsdotnet CreditAttribution: pillarsdotnet commentedHow many times must I un-follow this issue before it stops reappearing in my tracker?
Comment #52
sun@hixster: Please create a new issue for that. Thanks.