By jerome72 on
Hi,
I have three tabs in my search results page : Google (using module google_cse), Content, and Files (using module search_files).
By default, when a user performs a search, the default result is on the "content" tab. I would like the default tab be set to the "Google" tab...
Any clue ?
Cheers,
Jerome
Comments
hook_menu_alter
I would check out hook_menu_alter first.
Here is what I would try - I have done something similar with success recently:
Check the exact menu path of the goodle_cse search.
Thanks
Thank you very much for answering !
I tried this function, but instead of getting my default google tab, it removes the "content" and "google" tabs. I can't figure out why...
I only put this function in my module, I don't know what I missed.
Any idea ?
any resolution?
I'm also looking to change the default tab. Did you find a way of doing it?
The guy above is right, you
The guy above is right, you need to use hook_menu_alter. I don't know if there is any way to flag a menu tab as the default, but perhaps making its weight lighter would do the trick? Something like:
I'm just a beginner so this is just a suggestion, and may not be the preferred way of doing this.
- Ryan
Thanks Ryan, I see that your
Thanks Ryan,
I see that your tweak changes the order of the tabs, but what I was hoping to do was have the search block form actually go to another tab when submitted. For example, say when you submitted the search form and it defaulted to the User tab, as opposed to the Content tab (and therefor the path would be search/user as opposed to search/node).
I'm pretty new to this myself, so it's good to see what you were talking about.
kid_baco, Any luck on this?
kid_baco,
Any luck on this?
make some search tab the default tab
I know this is an old thread, but I hope it will usefull for someone. Add next functions in your module file (the example is shown for modul's name 'search_files' and a path to search 'google_cse', replace it for your case):
This Worked for me. with some modification
used hook_form_alter() for the first part
and changed 'search/google_cse' to 'search/google'
Here is a custom module I wrote
Here is a custom module I wrote to achieve the desired result you are looking for.
This module adds a setting in your administration theme to check a box to enable this functionality. Leave this option unchecked to use the default "Content" tab.
See the contents of my google_cse_default.module file below:
In my google_cse_default.info file I set the module to depend upon the google_cse module.
See the contents of my google_cse_default.info file below:
Thanks Ryan, this worked.
Thanks Ryan, this worked. Surprisingly the other solution of "disabling search module and give full permissions to google_cse" didn't worked
No results displayed using google seach box
Thanks Ryan,
Your custom module works for me making google cse the default search when a search is made from the drupal search box on the top RH corner of my site. However once one search has been made and the results displayed if the user then refines the search in the google search box and clicks search no results are displayed. If I disable the google_cse_default module then this works but google cse is no longer the default search. As anyone got any ideas what could be causing this issue. See for youself at http://openenegymonitor.org.
Thanks a lot,
Does this still work?
I added a new folder to my modules directory, and in it put the module and info files. I enabled the module, and checked the checkbox in the new settings page that was created. I cleared my cache and did a new search, and it still defaults to Content rather than Google. Did you have to change anything to make it work?