Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Im using hook_preprocess_views_exposed_form to change the output of my views exposed search box. I am able to successfully change the text on the search button, but I am not able to change the size. I cant figure out where I am going wrong. Here is what I have:

function MYTHEME_preprocess_views_exposed_form(&$vars, $hook) {
  // dsm($vars['form']);
  if ($vars['form']['#id'] == 'views-exposed-form-all-page') {
    $vars['form']['submit']['#value'] = t('Go');
    $form['text']['#size'] = '90';
    unset($vars['form']['submit']['#printed']);
    $vars['button'] = drupal_render($vars['form']['submit']);
  }
}

This is what I am stuck on:

$form['text']['#size'] = '90';
share|improve this question
    
$form['text'] is it correct index? –  Sumit Madan Dec 15 '12 at 7:03
    
Its $...['keys']['#size'], but I can get that to work either –  joe Dec 15 '12 at 7:32
add comment

1 Answer 1

up vote 0 down vote accepted

I think it would be better to change the form sooner than during themeing ... the best is to implement a form_alter hook, in this case

function MODULENAME_form_views_exposed_form_alter(&$form, $form_state)

you can try to dpm($form) first, to see what exactly you should change, and probably also add a condition about module id.

if you install advanced_help, this info can be found on your site at help/views/alter-exposed-filter :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.