I'm using hook_form_FORM_ID_alter to modify the content of the form on the search page — I want to remove the "phrase" and "not" fields, and restrict the "only of the types" checkboxes to a hand selected list of types.
I have the following code, which is being called and which I think should work:
function MYMODULE_form_search_form_alter(&$form, &$form_state, $form_id) {
unset($form['basic']);
unset($form['advanced']['keywords']['phrase']);
unset($form['advanced']['keywords']['negative']);
unset($form['advanced']['type']);
$form['advanced']['type'] = array(
'#type' => 'checkboxes',
'#title' => t('Only of the type(s)'),
'#options' => array(
'blog' => 'Blog entry',
'event' => 'Event',
'news' => 'News article'
)
);
// print_r($form);
// die;
}
Except node_form_search_form_alter gets to the search form after my form alter hook runs, so I don't get a chance to modify any of the form elements that it's adding.
I'm running Drupal 7.22.
How can I modify the advanced search form when my module hook runs before the hook that defines the advanced search form?