According to the documentation on overriding theme forms (http://drupal.org/node/112358) and exposed filters (http://drupal.org/node/112358), exposed filters can be themed by overriding theme_views_filters (and view-specific overrides with theme_views_filters_VIEWNAME). However, this seems impossible because at some point drupal_get_form('views_filters') must be called, and subsequently, drupal_render_form, which searches for theme_views_filters and does not take into account the view name. So while it is possible to override theme_views_filters, and theme_views_display_filters (and thus globally override the filters form theme for all views), it doesn't seem seem possible to create view-specific overrides for the exposed filters form.

Actually, while writing this, it looks possible to override theme_views_display_filters, avoiding drupal_get_form('views_filters') altogether. And then calling views_filters directly from the overriding function. But this seems like too much of a hack.

Was this possible in 4.7 or bug that appeared in the 5 version? Unsure if this is a documentation error or code error.

Comments

merlinofchaos’s picture

This is a weakness that appeared because of the way the form system changed from 4.7 to 5. I've meant to try to find a way to address it but I've been so busy it never happened.

introfini’s picture

I’m in the same situation. I hope you find the time :-)
Thanks,
introfini

coupet’s picture

I have tried this suggested solution in 5.x-1.5 but not overriding theme.

"Exposed filters" expose too much - Version: 4.7.x-1.x-dev
http://drupal.org/node/84124

merlinofchaos’s picture

Ok, I don't think I can fix this because of the way Drupal 5 works. :/

The only fix I can see is to add a hook_form_alter() which can give the form a new #theme function.

I've just added '#view_name' so that you can have some way to identify which form to form_alter.

Dimegga’s picture

Does this still apply for all Drupal 5 sites?

I"m using Drupal 5.7. Thanks

sun’s picture

Status: Active » Closed (won't fix)

As mentioned by merlinofchaos, a workaround has been implemented that allows you to identify the form.