Currently in my module, I have the following code :
function mymodule_form_search_form_alter(&$form, $form_state) {
if (isset($form['module']) && $form['module']['#value'] == 'node' && user_access('use advanced search')) {
$form['advanced'] = array(
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
unset($form['advanced']['type']);
$form['#validate'][] = 'node_search_validate';
dsm($form);
}
}
So, dsm($form) prints that form at the top of /search/node, but the 'advanced' array and sub-arrays don't render properly - i.e. they consist of the changes made in this module and nothing more - and have no effect on the form itself. I also have Devel printing the $page array, and comparing the two, it appears that I am trying to alter the correct form.
Anything I try to do to edit the advanced search form has no effect, no matter what. I've been able to render the form uncollapsed using js, but seeing as I'd like to do more with it and require a form_alter to do so, I need this to start working soon.
Comments
Comment #1
ankur commentedBy setting
$form['advanced']equal to a new array, you are wiping out the array that already exists there.Instead of
you want
Comment #3
dianacastillo commentedcan you explain which module you put this in ?
do you put it in the core?
I need to know how to do it in V6
Comment #4
dianacastillo commentedI made a module which keeps advanced search uncollapsed, you can download it here http://drupal.org/node/715634#comment-6713270