This should be a simple fix but I don't understand it.
It looks like the callback arguments don't match up. The theme function is not used at all and preventing me from converting search module into template files.
function search_box(&$form_state, $form_id) {
// Use search_keys instead of keys to avoid ID conflicts with the search block.
$form[$form_id .'_keys'] = array(
'#type' => 'textfield',
'#size' => 15,
'#default_value' => '',
'#attributes' => array('title' => t('Enter the terms you wish to search for.')),
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
// Always go to the search page since the search form is not guaranteed to be
// on every page.
$form['#action'] = url('search/node');
$form['#submit'][] = 'search_box_form_submit';
$form['#validate'][] = 'search_box_form_validate';
$form['#theme'] = 'search_box_form';
return $form;
}
function search_forms() {
$forms['search_theme_form']= array(
'callback' => 'search_box',
'callback arguments' => array('search_theme_form'),
);
$forms['search_block_form']= array(
'callback' => 'search_box',
'callback arguments' => array('search_block_form'),
);
return $forms;
}
Can anyone spare a free moment and provide a patch? Or just tell me how to fix it and I'll roll it into the conversion. http://drupal.org/node/164032
thanks
Comments
Comment #1
dvessel commentedMarking as critical.
Comment #2
dvessel commentedFound a workaround for now but there seems to be other problems with search.
Changed
$form['#theme'] = 'search_box_form';from search_box() to the $form_id.$form['#validate'][] = 'search_box_form_validate';doesn't exist and I get this error when viewing the search page:Comment #3
dvessel commentedThis is just so the template conversion can be reviewed.
http://drupal.org/node/164032
Comment #4
dvessel commentedAnd the patch..
Comment #5
dvessel commentedWell, I'm starting to belive this is actually the fix.
The callback arguments of search_forms() maps back to the $form_id.
Updated for latest head and marking for review.
Comment #6
dvessel commentedComment #7
wim leersWorks as advertised.
Comment #8
chx commentedThere is a simpler way to do the same...
Comment #9
dries commentedCommitted to CVS HEAD. Thanks.
Comment #10
(not verified) commented