Remove tab from search page

gmak - September 20, 2006 - 12:44

I have the Amazon Tools module installed and it is working very well. One of the things that it does is add an 'amazon.com' tab to the search page. I don't really want my users to search amazon via our site, so I'd like to disable the tab, but I can't seem to see where this gets created.

How do you remove tabs from the search page? Where in the amazon tools module would I need to look?

Thanks

I know how to add a tab...

sin - September 20, 2006 - 12:59

Search for function *_menu($may_cache) {
Inside search for MENU_LOCAL_TASK and $path => 'search/*' and comment a whole line with $item[] = ...

Thanks

gmak - September 20, 2006 - 15:26

Thanks for your help. That worked. One point to note, though, is that you need to go into your database and clear the cache table or else the tab keeps appearing.

You shouldn't make changes in the amazon.module file.

tom friedhof - October 12, 2006 - 01:34

You shouldn't make changes in the amazon.module file. If you ever plan on updating that module in the future, your hack will be lost. It's not good practice to hack a module unless it's lacking functionality, in that case you can submit a patch to the developer of that module to add., or you can extend that module with your own module without having to touch their module, but unfortunately in this case there is no way to alter the hook_menu() generated tabs, so writing your own module won't work either.

In this case, you just need to remove a tab which can be handled at the themeing layer. There is a write up that explains how to do this at:

http://drupal.org/node/68792

Thanks for comment, you right

sin - October 12, 2006 - 05:23

I did not know it is possible with PHPTemplate :) Thanks a lot for the link!

The only place that this

DVkid - September 20, 2006 - 13:18

The only place that this could be located as it is being added by the Amazon module is in the amazon.module file (or whatever the module file happens to be called.

Typically modules are well commented, meaning each chunk of code has a comment above it explaining what it does. With that in mind, look through the file for the term 'search.'

Good luck.

its kind of late... but may be itwud be of use to somebody

depace - August 14, 2007 - 11:40

to remove a tab from a specific node type.... (replace node_type with ur type)

this is a little refined version than the one discussed at to http://drupal.org/node/68792. only change is if ($vars['node']->type == 'node_type') { --> which enables me to remove "Edit" tab from my particular "node type" page...

in your template.php file and or edit

<?php
function _phptemplate_variables($hook, $vars = array())
    {
        if(
$hook == 'page') {
            if (
$vars['node']->type == 'node_type') {
               
__remove_tab('Edit' $vars);
            }
        }
        return
$vars;
    }

function
__remove_tab($label, &$vars)
    {
       
$tabs = explode("\n", $vars['tabs']);
       
       
$vars['tabs'] = '';
       
        foreach(
$tabs as $tab) {
            if(
strpos($tab, '>' . $label . '<') === FALSE) {
               
$vars['tabs'] .= $tab . "\n";
            }
        }
    }
?>

This will remove "Edit" tab from "node_type" page...

 
 

Drupal is a registered trademark of Dries Buytaert.