Let search_config work without arg(1) == 'node'

dhrgovic - April 19, 2009 - 06:02
Project:Search config
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

When no search terms are present, search_config doesn't kick in.

I just patched search_config's form_alter in my version to let it.

    // if (arg(1) == 'node') {
    if (arg(0)=='search') {

The reason is that I like to expand the advanced search form when users just hit the search button (code below for anyone interested).

In your helper module's form_alter:

switch ($form_id) {
case 'search_form':
if (!arg(1)) { // if it's only /search and no keywords, expand the advanced search fieldset
$form['advanced']['#collapsed']=FALSE;
}
break;
}

#1

dhrgovic - April 19, 2009 - 06:15

Oops, that wasn't good. Doesn't let search_config kick in when using search 404. Better to remove the arg(1) condition altogether.

#2

canen - May 25, 2009 - 03:19
Status:active» fixed

I see no immediate harm in doing this. Committed in http://drupal.org/cvs?commit=216036.

#3

dhrgovic - June 2, 2009 - 19:43

Thanks, canen!

#4

canen - June 2, 2009 - 21:59
Status:fixed» active

dhrgovic,

Sorry to disappoint but I will need to revert this since it breaks the search forms on none node search types. See http://drupal.org/node/477802

I'll see if there is another way to easily implement it.

 
 

Drupal is a registered trademark of Dries Buytaert.