Hi all,
I'm trying to hide some tabs installed with some modules and to do that I'm using hooks like:
hook_menu() hook_menu_alter()
and I'm setting the access_callback to false. Some tabs are hidden with hook_menu() other with hook_menu_alter() (why?) and another one doesn't want to go away anyhow :) The tab is been installed with the flag module and it's called Bookmarks.
So do you know the best way to hide tabs? Should I use temable functions?
Regards, Sal
IMHO, the best way to hide tabs is with permissions. You might want to open an issue on the module explaining your use case and why it should provide additional permissions. I'm sure a patch would be most welcome.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Salvatore De Paolis
I'm trying to hide some tabs installed with some modules and to do that I'm using hooks like:
hook_menu() hook_menu_alter()
and I'm setting the access_callback to false. Some tabs are hidden with hook_menu() other with hook_menu_alter() (why?) and another one doesn't want to go away anyhow :) The tab is been installed with the flag module and it's called Bookmarks.
On Thu, 10 Nov 2011 10:02:17 -0800 (PST) "Ms. Nancy Wichmann" nan_wich@bellsouth.net wrote:
IMHO, the best way to hide tabs is with permissions. You might want to open an issue on the module explaining your use case and why it should provide additional permissions. I'm sure a patch would be most welcome.
I've seen an example on drupal about hiding tabs with permissions and I agree it's great. About this special case I also understood the reason. The module Flag creates this tab using a view and apparently hook_menu_alter() doesn't work with tab created from views.
Sal
You can still use hook_menu_alter, just set the weight of your module higher than that of Flag in the system table. That will cause your hook_menu_alter to fire after Flag.
Jamie Holly http://www.intoxination.net http://www.hollyit.net
On 11/10/2011 1:07 PM, Salvatore De Paolis wrote:
On Thu, 10 Nov 2011 10:02:17 -0800 (PST) "Ms. Nancy Wichmann"nan_wich@bellsouth.net wrote:
IMHO, the best way to hide tabs is with permissions. You might want to open an issue on the module explaining your use case and why it should provide additional permissions. I'm sure a patch would be most welcome.
I've seen an example on drupal about hiding tabs with permissions and I agree it's great. About this special case I also understood the reason. The module Flag creates this tab using a view and apparently hook_menu_alter() doesn't work with tab created from views.
Sal
On Thu, 10 Nov 2011 13:29:42 -0500 Jamie Holly hovercrafter@earthlink.net wrote:
You can still use hook_menu_alter, just set the weight of your module higher than that of Flag in the system table. That will cause your hook_menu_alter to fire after Flag.
Nice hint :)
Sal
Pretty sure you mean the Views module, and not Flag. Also the easiest way to hide the bookmarks tab, is to just disable the view, or delete the unused flag.
-Mike
Salvatore De Paolis wrote:
On Thu, 10 Nov 2011 13:29:42 -0500 Jamie Holly hovercrafter@earthlink.net wrote:
You can still use hook_menu_alter, just set the weight of your module higher than that of Flag in the system table. That will cause your hook_menu_alter to fire after Flag.
Nice hint :)
Sal
That could be. I was just giving a system for having your hook take action after another module's implementation of the same hook. Setting weights always works. Of course in D7 we also have the hook_module_implements, which is a nice one!
Jamie Holly http://www.intoxination.net http://www.hollyit.net
On 11/10/2011 3:09 PM, Michael Prasuhn wrote:
Pretty sure you mean the Views module, and not Flag. Also the easiest way to hide the bookmarks tab, is to just disable the view, or delete the unused flag.
-Mike
Salvatore De Paolis wrote:
On Thu, 10 Nov 2011 13:29:42 -0500 Jamie Hollyhovercrafter@earthlink.net wrote:
You can still use hook_menu_alter, just set the weight of your module higher than that of Flag in the system table. That will cause your hook_menu_alter to fire after Flag.
Nice hint :)
Sal
On Thu, 10 Nov 2011 12:09:32 -0800 Michael Prasuhn mike@mikeyp.net wrote:
Pretty sure you mean the Views module, and not Flag. Also the easiest way to hide the bookmarks tab, is to just disable the view, or delete the unused flag.
-Mike
I meant the Flag module because I think it creates such a view by default, it's not something that comes from the View module. Ye, I've done this way disabling the view, I'm not deleting it because I might want to use a different layout and put such information elsewhere.
Sal
Thats fine, but that tab is provided by the view that Flag module creates for you, alternatively, you could just edit that view as well.
-mike
Salvatore De Paolis wrote:
On Thu, 10 Nov 2011 12:09:32 -0800 Michael Prasuhn mike@mikeyp.net wrote:
Pretty sure you mean the Views module, and not Flag. Also the easiest way to hide the bookmarks tab, is to just disable the view, or delete the unused flag.
-Mike
I meant the Flag module because I think it creates such a view by default, it's not something that comes from the View module. Ye, I've done this way disabling the view, I'm not deleting it because I might want to use a different layout and put such information elsewhere.
Sal
On Thu, 10 Nov 2011 13:54:48 -0800 Michael Prasuhn mike@mikeyp.net wrote:
Thats fine, but that tab is provided by the view that Flag module creates for you, alternatively, you could just edit that view as well.
-mike
Yes I was thinking about it, editing the view and removing the menu so it can be available elsewhere.
Regards, Sal
Menu permissions have been a great way of "hiding" tabs since I've been using Drupal (4.7.10). And many modules have expanded their permissions to accommodate users needs, so don't be afraid to ask.
The View can be limited to specific roles.
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Salvatore De Paolis
I've seen an example on drupal about hiding tabs with permissions and I agree it's great. About this special case I also understood the reason. The module Flag creates this tab using a view and apparently hook_menu_alter() doesn't work with tab created from views.