Modifying the exposed filters form in a display plugin?

Events happening in the community are now at Drupal community events on www.drupal.org.
pukku's picture

Hi! I'm writing a display plugin which needs to have a form at the top to control some display options. In order to allow users to set the display options at the same time as they set any filter options, I need (I think) to put the display options into the exposed filters form.

I can force the form to be rendered by implementing uses_exposed() in the display plugin. Right now, I then use hook_form_alter() to modify the form, and then process the results of the form submission in the display plugin's query() function.

However, this leaves the logic of this split across several files -- I need to have the .module file for hook_views_api() and hook_form_alter(), then I need the module.views.inc file for hook_views_plugins(), and then I need the module_plugin_displays_xxx.inc file for the actual class.

This means that the logic of the module is split between a hook_form_alter() call in the main file, and query() in the plugin class.

I've been reading the code, but I can't seem to find any obvious way to modify the exposed filters form from within the plugin class. There is a function render_filters() defined in views_plugin_display.inc, which seems like it might be for this kind of thing, but it is defined as a blank function, and it is never called anywhere within views (at least, not that grep can find).

Is there something I'm missing? Is there some way to combine my logic into one file, so that it makes sense?

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: