Change the size of the Views Fast Search input field?

barrysampson - August 21, 2007 - 19:50

Hi,

I'm using the Views Fast Search module, and need to make the input field larger than the default size of 10.

I've tried following the instructions here http://drupal.org/node/87545 and modified the code to apply to textfields. This does work, but now the title of all of my input fields are truncated to just the first letter.

Is there a better way to resize the input field, or a way to fix the titles?

I've put this in my template.php file

function aberdeen_textfield($element) {
  // Pass to phptemplate, including translating the parameters to an associative array. The element names are the names that the variables
  // will be assigned within your template.
  return _phptemplate_callback('textfield', array('element' => $element));
}

and created a file called textfield.tpl.php

<?php
/***
* Customised formatting of input type="textfield" to widen search input field
* These fields are available:
* $element
**/

// Change the default $size

 
_form_set_class($element, array('form-text'));
 
$output = theme('form_element', $element['#title'], '<input type="textfield" name="'. $element['#name'] .'"'. ($element['#attributes'] ? ' '. drupal_attributes($element['#attributes']) : '') .' id="'. form_clean_id($element['#id']) .'" size=\"40\"' ."\" />\n", $element['#description'], $element['#id'], $element['#required'], form_get_error($element));

print
$output;
?>

Thanks

Barry

 
 

Drupal is a registered trademark of Dries Buytaert.