User login

Theme Views FastSearch Search Bar

Searched words: 
themed the findaction viewsfastsearch field theme fast search view searchbox glue module snippet find names of forms

This implementation of hook form_alter (use your own module name instead of wsf_action) will cut down on the giant textfield used by Views FastSearch by default.

The commented out code is what you can use to identify what the heck is going on in any form.

<?php
function wsf_action_form_alter($form_id, &$form) {
// global $user; if ($user->uid==1) drupal_set_message("Form ID: " . $form_id);
// global $user; if ($user->uid==1) drupal_set_message('<pre>' . print_r($form, TRUE) . '</pre>');
 
switch ($form_id) {  // not $form['#id']
   
case 'views_filters':
      if (isset(
$form['filter0']) && $form['filter0']['#type'] == 'textfield') {
       
$form['filter0']['#size'] = 20;
      }
  }
}
?>

That's a quick hack to make your Views_FastSearch form look better... the Agaric way.

Resolution

Comments

form_alter is an awesome

form_alter is an awesome Drupal hook, and that's all you need to use it really-- the commented out statements can be used to print everything about a form, which you can then use to mess with the elements.

One thing to do is for all strings put in single quotation marks which aren't part of the printout but are necessary when you collapse the form variables into linear array paths.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Internal paths in single or double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or path. Paths to files in single or double quotes, written as "files:somefile.ext", for example, are replaced with the appropriate URL that can be used to download the file.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.