[development] Views exposed filters hierarchical display

Wim Leers work at wimleers.com
Thu Aug 16 10:00:43 UTC 2007


Hi Laura,

this is certainly possible. I've done it right here: http:// 
64.40.146.141/forum/filter. Please choose "Chipset" first, then  
select "fixed" in the status for a demo. Then choose "Graphics A" or  
so. Only the first set of conditional selects have been configured  
properly for everything. Basically this is "my own project management  
system" (remotely, actually). It's based on taxonomy. And the reason  
I built it, was that I needed something *much* more simple in use for  
my users than the project* modules. Note that it could still use some  
theming. It's called condvoc, which stands for Conditional Vocabularies.

How does it work? You create vocabularies as you like. Then you can  
configure in the condvoc administration page (which probably has the  
worst usability ever, because of the amount of configuration  
required) which vocabulary/vocabularies should be displayed when  
which term is selected (also possible: display when any child term of  
the selected term is selected). So what you basically do, is  
configuring the relationships between terms and vocabularies, i.e.  
which vocabulary depends on which term(s). It's also possible to  
configure it through PHP, which is IMO a whole lot simpler, it uses a  
fairly simple hierarchical array structure in which you put the tid's  
and vid's.

However, this was the first module I ever wrote. The admin page alone  
is 400 lines, the .module is 500 lines and the .module generates a  
lot of JavaScript, for the conditionals to work. That's right,  
instead of providing the JS with some settings (via Drupal.settings),  
I'm generating the code specific for that page. No AJAX requests are  
made, all vocabulary selects are rendered and are sent in the HTML.

Whomever read this far, congratulations :P

I hope this information is at least somewhat useful to you. It should  
learn you that this is a possible approach, but it's a very flawed  
one. Things you should not take over:
1) no JS should be generated
2) somehow, the administration should be kept manageable

I think to do this properly, a Relationship API would be very, very  
useful. Unfortunately, the few modules that attempted to do this have  
been discontinued IIRC. And an AHAH/AJAX interface for defining the  
relationships (drag 'n drop, like Panels 2) would be *very* useful to  
keep the administration usable.

It would be possible to create a module that allows for conditional  
exposed filters, but a more generic solution ("Conditial Form Items"  
or something like that?) would be better. I'm interested in helping  
with this, but not in writing it on my own.

Looking forward to the feedback :)

Wim Leers

mail     work at wimleers.com
mob.    0032 (0)495 83.63.68


On Aug 15, 2007, at 15:37 , laura oldenbourg wrote:

> Is it possible with views.module that you start with one drop down  
> selection menu (in my example taxonomy vocab 'Media type'), and  
> depending on what the user selects there, he/she is presented with  
> the next selection of dropdown menus?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070816/14cba148/attachment.htm 


More information about the development mailing list