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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dvessel’s picture

Priority: Normal » Critical

Marking as critical.

dvessel’s picture

Title: Search form not themable » Problems with search system. d6

Found 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:

notice: Undefined offset: 2 in /DRUPAL-HEAD/includes/menu.inc on line 457.
dvessel’s picture

Status: Active » Needs work

This is just so the template conversion can be reviewed.

http://drupal.org/node/164032

dvessel’s picture

FileSize
649 bytes

And the patch..

dvessel’s picture

Status: Needs work » Needs review
FileSize
719 bytes

Well, 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.

dvessel’s picture

Title: Problems with search system. d6 » search theme form broken
Wim Leers’s picture

Works as advertised.

chx’s picture

FileSize
439 bytes

There is a simpler way to do the same...

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)