Skip to main content
edited title
Link
4life
  • 4.7k
  • 8
  • 26
  • 25

How to theme each filedfield of exposed filter from Views?

Tweeted twitter.com/#!/StackDrupal/status/382478845385125888
Source Link
AshwinP
  • 406
  • 1
  • 5
  • 16

How to theme each filed of exposed filter from Views?

I have found the theme template for exposed filter form of view. Template name: views-exposed-form.tpl.php

Inside the template I found the $widgets array and for loop for each $widget display in form.

But it is rendered HTML widget How can I get only values array for each combo box to render output for my combo box as I want?

for instance:

I have one combo called Country: Country has hierarchy level of list

Asia
- India
- Sri lanka
- thailand
- Indonesia

etc...

So, I would like to make my combo just like this

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_optgroup

<select>
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

This will identify the parent / child category in combo? can we do this directly in drupal 7 Views for Expoesd Filters Combo ? or How can I theme myself to override its HTML?