Views exposed filters #weight has no effect? here is how to fix it.

You, DrupalDrupal views
Back

I hope you have a basic understanding of how Views works and what is the form_alter etc. Did you try adding #weights to the form_alter elements of a views exposed form and it didn't work? here is why, exposed forms use some theming function so it can render the lable and descriptions you set of the exposed field settings and create a pretty form.

Ok?. But we can use an empty theme function that override the exposed form theming, so what it does is it will remove all the none Drupal FAPI and use only FAPI. That means you'll get the full control over the form and you can do what ever you want on the form in the default Drupal way.

To do that add following function to your theme:

function THEMENAME_views_exposed_form($variables) {}
© Heshan Wanigasooriya.RSS

🍪 This site does not track you.