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

Comments

sin’s picture

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

gmak’s picture

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.

tom friedhof’s picture

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

sin’s picture

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

StevenSokulski’s picture

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.

depace’s picture

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

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...