Non collapsible advanced search


/ Published in: PHP
Save to your folder(s)

Makes Drupal Advanced Search form non collapsible and expanded by default.


Copy this code and paste it in your HTML
  1. <?php
  2. /**
  3. * Theme override for search form.
  4. *
  5. * Replace themename with your theme's name.
  6. */
  7. function themename_search_form($form) {
  8. $output = '';
  9. // Print out the $form array to see all the elements we are working with.
  10. //$output .= dsm($form);
  11. // Once I know which part of the array I'm after we can change it.
  12.  
  13. // You can use the normal Form API structure to change things, like so:
  14. // Change the advanced search field to non collapsible.
  15. $form['advanced']['#collapsible'] = 0;
  16.  
  17. // Make sure you call a drupal_render() on the entire $form to make sure you
  18. // still output all of the elements (particularly hidden ones needed
  19. // for the form to function properly.)
  20. $output .= drupal_render($form);
  21. return $output;
  22. }
  23. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.