A new plugin to apply an exposed filter multiple times with diferente values using AND/OR

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

Hello:

I'm developing a new plugin for views 2. It allows users to apply the same filter multiple times with different values.

Then, a user can make a lists of nodes and filter all nodes created by user admin where nid beetween 4 and 6 OR node id greather than 16.

The plugin works, it has some (a lot of) bugs still, but works.

Filters are saved into $_SESSION variable like drupal does for "content admininstration" and "user administration" screens.

What I'm triying to do is display a button to delete a specific value in $_SESSION. I can't use hook_form_alter() to alter the form exposed filter because $_SESSION is not updated when hook_form_alter() is executed (I don't know why)

To render the table I'm using render() function into my display plugin (see atached module)

I understand that FORM API will not allow to add a form element by this way.

The question then is, How can I do that?

I'm attaching the whole module, this module is not ready for production use and is not present in drupal.org yet. A project for it will be created once it has been further developed. Please be free to make any suggestions. I have programed a few modules before, but views API is a bit more complex :P.

More than anything else I would
- like to get confirmation that I am going in the right direction
- collaborate with anyone else in the community working on something similar

Rename file to .tar.gz and untar.

AttachmentSize
xviews.tar_.gz_.txt4.15 KB

Comments

*_*

beautifulmind's picture

Nice plugin.
By the way, where do you wanna show the button to delete what on the interface?

:)
Beautifulmind

Thanks. I have solved my

mariano86's picture

Thanks.

I have solved my problem. Here is a preview of the plugin interface:

However now I have another problem.

Views build the exposed filter forms using values from url. Something like:

http://localhost/my_view_name?xgroup_op=AND&xgroup_id=0&xfilters=nid&type_1_op=in&nid_op=%3D&type_1=All&nid[value]=7&nid[min]=&nid[max]=&form_build_id=form-227391ba4f2b2ee5d98c14f202f0596c&form_token=3b117bf5b8c24987fd674a55f194194e&form_id=views_exposed_form&xview=contenido

What I need is prevent this behaviour, and redirect the submit form to http://localhost/my_view_name

Why? Well, with this plugin users applies only one filter per submit, and I need that exposed filters "don't remember" their values from the last submit.

The code of the module is attached.

I think that this module can make great administrative interfaces for drupal. But I need a bit of help to continue developing this module, there are some aspects very hard to solve with my knowledge of API Views

Views Developers

Group organizers

Group notifications

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