I´ve added the search form inside my main menu but I wasn´t able to do it by overriding my subtheme´s template.php file.

Here are my alterations of the original form.inc file:

function bootstrap_form_search_form_alter(&$form, &$form_state) {
  $form['#attributes']['class'][] = 'form-search';
  $form['#attributes']['class'][] = 'pull-right';
  $form['#attributes']['class'][] = 'input-large';

  $form['basic']['keys']['#title'] = '';
  $form['basic']['keys']['#attributes']['class'][] = 'search-query';
  $form['basic']['keys']['#attributes']['class'][] = 'span2';
  $form['basic']['keys']['#attributes']['placeholder'] = t('Search');

  // Hide the default button from display and implement a theme wrapper to add
  // a submit button containing a search icon directly after the input element.
  $form['basic']['submit']['#attributes']['class'][] = 'element-invisible';
  $form['basic']['keys']['#theme_wrappers'][] = 'bootstrap_search_form_wrapper';

  // Apply a clearfix so the results don't overflow onto the form.
  $form['#suffix'] = '<div class="clearfix"></div>';
  $form['#attributes']['class'][] = 'content-search';

Then I added a variable in my subtheme´s template.php:

function mytheme_preprocess_page(&$variables) {
  $search_box = drupal_render(drupal_get_form('search_form'));
  $variables['search_box'] = $search_box;

My problem is that I get an error in my logs:
Strict warning: Only variables should be passed by reference in skeidgnup_theme_preprocess_page() (line 13 of /Applications/MAMP/htdocs/mysite.com/profiles/mydistro/themes/mytheme/template.php).

Is there a way to override the hook_form_search_form_alter() function in my own theme?

I´m assuming the issues are related but they might not be.

Hopefully someone can lead me to the right direction.


markcarver’s picture

Status: Active » Closed (won't fix)

Scripted response: This issue has been closed while cleaning up the issue queue. This has likely already been fixed in 7.x-3.x. If it has not, please create a new issue describing the exact issue with that version. The 7.x-2.x branch currently only receives security fixes.