I like to be able to theme the advanced search so that the proximity search with the googlemap is the main way of searching. Rather then tucked away under the options as it currently is.

Are there any pointers for doing this or modules/ views recipes that exist or do I just have to play with the node overrides?

CommentFileSizeAuthor
#5 advanced_search_uncollapsed.zip1.13 KBdianacastillo

Comments

rooby’s picture

Status: Active » Fixed

Use hook_form_alter(&$form, &$form_state, $form_id)

For an example see the location_search modules location_search_form_alter(), which is where the advanced form is added to the search form.

You could do things like:

<?php
/**
 * Implementation of hook_form_alter().
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_form' && arg(1) == 'location') {
    if (isset($form['advanced'])) {
      // Uncollapse fieldset by default.
      $form['advanced']['#collapsed'] = FALSE;
      // Move the fieldset to the top.
      $form['advanced']['#weight'] = -10;
    }
  }
}
?>

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dianacastillo’s picture

Status: Closed (fixed) » Needs review

i put this in my template.php in my theme

function search_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_form' ) {
if (isset($form['advanced'])) {
// Uncollapse fieldset by default.
$form['advanced']['#collapsed'] = FALSE;
// Move the fieldset to the top.
$form['advanced']['#weight'] = -10;
}
}
}

and it doesnt change anything, the advanced search is still collapsed. I put the them name instead of search that doesn work either
Is there somewhere else I'm supposed to put it?

thank you

rooby’s picture

Status: Needs review » Fixed

The hook_form_alter function should go into a custom module.

For example, you create a module called my_search_customisations (you can call it something better I'm sure).
Then in that module you have

<?php
function my_search_customisations_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_form' ) {
    if (isset($form['advanced'])) {
      // Uncollapse fieldset by default.
      $form['advanced']['#collapsed'] = FALSE;
      // Move the fieldset to the top.
      $form['advanced']['#weight'] = -10;
    }
  }
}
?>

If you are unfamiliar with creating modules there is mush info on it at http://drupal.org/node/206753

dianacastillo’s picture

StatusFileSize
new1.13 KB

okay, i made a module which does this, I am attaching it. how can I publish this so other people can use it?

rooby’s picture

If you go to your account profile page there is a tab called "Your projects".
If you go there there will be a list of your existing projects and a link to add one.
You can add a sandbox project there.

Then you can refer people to that sandbox.
If you want to can also promote it to a full project. To do this you first have to have it approved by posting a project application issue at http://drupal.org/project/projectapplications

There is more detailed information at http://drupal.org/node/1011196 and its sub-pages.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.