[SOLVED][Drupal Views] Theming exposed filters forms

| | 1 min read

Many Drupal users have expressed their interest in Theming Exposed Filter Forms of the Views they had created. The most commonly requested feature is to change the label of the Submit button to 'Search' or something more useful. Many Drupal users have realized that they lost all the labels on the filter widgets when using the views_exposed_form() function to do the job. If you are encountering the same situation in your Drupal website then read on to find the solution.

Here is the fix. You can use hook_form_alter to do the job. Use the sample here for reference

 * Implementation of hook_form_alter().
function MODULE_form_alter(&$form, $form_state, $form_id) {
   if($form_id == 'views_exposed_form' && $form['#id'] == 'views-exposed-form-mypage-page-1') {    
      $form['value']['search_pane']['#type'] = 'hidden';
      // ... manipulate more form fields

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.