Can I hide the
Edit | View
tabs on top of each node ?
I've searched for this option in theme settings (both global and standard theme but I couldn't find it).
I still want to be able my customer to edit / administer content, so I cannot just remove the permission for it.
thanks
there is a module for that: tab tamer allows to hide or disable tabs and rename them as well.
here is a very easy solution for you. (Drupal 7)
Open your page.tpl.php in your current template and search for the $tabs variable.
Remove the render code if you want to hide it completely.
If you want to display it only to administrators use this code
The above code checks if the user is administrator. If it is it will render the tabs. If not it wont render them.
I use the following in template.php by theme (which is perhaps a little hacky, I feel I should be considering unsetting $tabs instead):
Or you could ommit:
from your page.tpl.php...
This really is a presentational thing, not a functionality thing, so it should be done at the theme level.
The problem with overriding
theme_menu_local_tasks()
is that you override/take a hatchet to the entire local task display, when you really just want to get in there with a scalpel to remove two specific local tasks. So, you need to get a little more specific.theme_menu_local_tasks()
gets the current page's local tasks and passes them tomenu_local_tasks()
. Here, two theme functions are used:theme_menu_item_link()
, which gets the link markup for the tasktheme_menu_local_task()
, which gets the<li>
element for the task.So, you can get rid of the View and Edit local tasks in a really robust way by overriding
theme_menu_item_link()
andtheme_menu_local_task()
to include your check for them:This way, you're relying on the menu router path, not modifying the menu router item, and achieving the result you want with minimal changes to core functionality or theming.
On the module side, you could do something that decouples the Edit's menu entry from the local tasks for the node:
The edit path is still there, but now it is not associated with the View tab. This includes the edit page itself--no View tab there.
The simplest solution to hide the tabs is to add this class in your theme css