Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Well, posting a proposal.
I have (over)commented the code.
The taxonomy (with depth, views_filters_selective_handler_filter_term_node_tid_depth) does not work jet.
Comment | File | Size | Author |
---|---|---|---|
#13 | illegal-notices-solved.patch | 28.65 KB | neoglez |
#12 | views_hacks_vfs_D7_branch-1170644-11.patch | 28.93 KB | Jerome F |
#12 | Capture d’écran 2011-05-30 à 10.11.31.png | 192.01 KB | Jerome F |
#10 | views-hacks-vfs-d7-branch.patch | 27.95 KB | neoglez |
#9 | Capture d’écran 2011-05-28 à 20.33.20.png | 147.67 KB | Jerome F |
Comments
Comment #1
aristeides CreditAttribution: aristeides commentedso... everything BUT the taxonomy is working??
Comment #2
neoglez CreditAttribution: neoglez commentedYou should be answering your self to that question.
Comment #3
Jerome F CreditAttribution: Jerome F commentedThank you for posting @neoglez!
Comment #4
aristeides CreditAttribution: aristeides commentedstarted testing, reporting any bugs I find along the way.
Using it with node reference fields ( http://drupal.org/project/references ) I received the following errors:
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined index: filter-status in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 124 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined index: views_handler_filter_in_operator in views_filters_selective_exposed_form_plugin->get_reducer_handler() (line 221 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined index: views_handler_filter_in_operator in views_filters_selective_exposed_form_plugin->get_reducer_handler() (line 221 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Comment #5
Jerome F CreditAttribution: Jerome F commentedI second that using taxonomy fields (no reference fields here):
Using location country field only and avoiding taxonomy, the results are not limited. All the countries still appear in the select list. But no notices. I guess it's just not taken into account by views filters selective.
Limit "Location: Country" values to result set is checked though
Which field type is currently working?
@neoglez I wrote that I asked a php developper to help me, but unfortunately he isn't a drupal developper and he got lost in drupal's module developement. Sorry for that, appart from testing I will not be able to provide much help here.
Comment #6
neoglez CreditAttribution: neoglez commentedThe error
Notice: Undefined property: stdClass::$nid in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 115 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
and
Notice: Undefined index: filter-status in views_filters_selective_exposed_form_plugin->exposed_form_alter() (line 124 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc) DON'T concern this module. If you install the latest (dev) version of node reference the error desapear (all views MUST have a base_field property).
Regarding the error Notice: Undefined index: views_handler_filter_in_operator in views_filters_selective_exposed_form_plugin->get_reducer_handler() (line 221 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc).
Notice: Undefined index: views_handler_filter_in_operator in views_filters_selective_exposed_form_plugin->get_reducer_handler() (line 221 of /var/www/html/sites/all/modules/views_filters_selective/views_filters_selective_exposed_form_plugin.inc) read the comments on the code (you must implement hook_views_filters_selective_handler) becouse this module provides an API.
Good luck ;-)
Comment #7
neoglez CreditAttribution: neoglez commented@Jerome, It's Ok, i'm beeing sponsored ;-)
Testing is great.
On the other hand only taxonomy filters (objects of the class views_filters_selective_handler_filter_term_node_tid ) are supported out of the box at the momment. Theoretically (i haven't tested this) a developer should be able to implement hook_views_filters_selective_handler for the filters that he wants, that's the power of the API (a litter like implemeting this module to hook into views).
When i find time i'm gonna add suport for more types of filters.
Comment #8
Jerome F CreditAttribution: Jerome F commented1) That's right it works for one taxonomy field now, which is awesome !
2) It gets more complicated when using more than one taxonomy filters, just because on the first page view, all the filters are set on the first taxonomy term available, even if it's not an available term, therefore I get several messages:
An illegal choice has been detected. Please contact the site administrator.
then I select some terms, If I find an available term it's working fine.
The same thing happens when I hit reset if I enable the reset button.
3) Apparently there's no way to leave the select field on any now, is this by design? Isn't it possible to let the user leave a select list blank, when using more than one filter?
4) Side note it's important to uncheck "remember las select choice" - this seems logical. If not you have to deal with: An illegal choice has been detected. Please contact the site administrator.
5) What do you mean by Undefined index: filter-status and Undefined index: filter-type notices don't concern this module? I don't have nodereference filter and still:
There's no way to reproduce the other notices mentionned above, with only taxonomy filters checked. You've made your point.
Comment #9
Jerome F CreditAttribution: Jerome F commentedabout point 2) in last comment first screenshot is on page view, second screenshot is with an user selected term. If you refresh the page, you're back to first screenshot.
first URL :
http://exposedfilters.localhost:8082/restaurants
second URL
http://exposedfilters.localhost:8082/restaurants?field_business_catering_tid=12&field_business_ambiance_tid=18&field_business_type_tid=3&field_business_prices_tid=7&city=&country=All
So the best thing would be a default behavior for the view with - any - selected for each filter when you first display the page or reset the view filters, it would correct this issue and provide an expected feature for this kind of widgets.
Comment #10
neoglez CreditAttribution: neoglez commented@Jerome F Thanks for the info. It was VERY helpfull.
The problem is when the configured filter ID is other than the default (field_business_catering_tid, etc vs tid, tid_1, etc. in you description)
The display and the the view object don't update their filter's index but the $form_state and $form contain the id configured y the user-admin, maybe i file a bug/feature request report in views.
I had noticed the 'Ilegal choice' error and i was thinking in the right way to handle it becouse i was avoiding overriding the views_exposed_form_plugin::render_exposed_form function (there is no way to hook in the form rendering process other than that) but apparently with some changes i'm not seeing the error although i'm not sure if it is completely gone.
I agree with this, but (remember the DAU theory) we should handle it, the same happens with 'required', anyway if these options are checked some logical problems arise although no php or drupal errors (for 'required' i had to re-login).
I'm posting what i find a very stable release ;-) at least in my controlled enviroment as a patch against the views_hacks D7 branch (only reachable through git).
Testing help is wellcome, if problems are found change the status to needs work, if you find it OK then to RTBC.
Comment #11
neoglez CreditAttribution: neoglez commentedI'm taken over this one.
Comment #12
Jerome F CreditAttribution: Jerome F commentedSo in the meantime (befor this is taken into account in views) what should we do use default machine names for taxonomies? My view is still displayed as in the screenshot.
What about the - any - choice? Is it doable?
In the attached patch, I just added some cleanup, you need to provide @file blocks and to use two spaces instead of tabs. The coder module can help you to cleanup your code.
by the way what's the DAU theory?
Comment #13
neoglez CreditAttribution: neoglez commentedPatch for the 'illegal... ' error.
Let's let the -any- as a feature request until this have been marked RTBC and maybe reviewed by infojunkie.
Comment #14
Jerome F CreditAttribution: Jerome F commentedThank you.
Is there a problem using a menu link to the view page like this: www.example.com/restaurants
Then there's nothing in the url to trigger views filters selective like in: www.example.com/restaurants?field_business_catering_tid=11&field_busines...
Probably that's why the illegal choice hapens on first page view and page refresh. What do you think?
Comment #15
neoglez CreditAttribution: neoglez commentedI'm sorry, i don't understand very well what you mean, so:
Q: Is there a problem using a menu link to the view page like this: www.example.com/restaurants
Then there's nothing in the url to trigger views filters selective like in: www.example.com/restaurants?field_business_catering_tid=11&field_busines...?
A: NO, there should be no problems, the $_GET parameters (?field_business_catering_tid=11&field_busines...) are set and handle (yeah!) by views, you can assign the url/uri/path that you want to your views (it must be a PAGE DISPLAY though).
Q: Probably that's why the illegal choice hapens on first page view and page refresh.What do you think?
A: NO, after applying the patch in #13 you should get NO ERRORS. The VFS module just takes action if there is a USER INPUT (in the first page view there is no user input). Try to re-login, clear cache (drupal & views) and/or rebuild the view. I tested this under two not so controlled different enviroments (a local win PC and a Debian dev server) and it works just great.
Remenber: if (everything_ok) {issue_status = RTBC} XD
Comment #16
Jerome F CreditAttribution: Jerome F commented@neoglez: Oh yes, sorry, I had to CHECK the require checkbox ! That was it ! You did a very good work on this, than you!
I can confirm it works if :
- Require is checked (in the taxonomy term exposed filter's configuration)
- Show hierarchy in dropdown in unchecked (in the taxonomy term exposed filter's settings)
- You use taxonomy term exposed filters only, but you can use more than one of them which is great!
Hide if empty works OK!
For further improvements, the main feature requests in my opinion are:
1) Other filters:
I tried to use a country exposed filter as well but this is wired, if you select Luxembourg, it actually hides the nodes with Luxembourg instead of displaying them only, so there's a feature request for compatibility with other exposed filters but we have already your answer about in #7
2) filter not required (the - Any - option)
Comment #17
neoglez CreditAttribution: neoglez commentedThanks!!
The Community is just great ;-)
Comment #18
infojunkieEveryone: thanks for your efforts to port and test this. Much appreciated.
@neoglez: Would you like to participate in Views Hacks as co-maintainer for the D7 branch?
Comment #19
paulgemini CreditAttribution: paulgemini commentedsubscribing
Comment #20
neoglez CreditAttribution: neoglez commented@infojunkie
Yes! :-) I like this module very much.
...and we must hurry: D8 is comming.
Comment #21
infojunkie@neoglez: Thanks for your help! I gave you maintainer access to the module and added a 7.x-1.x tag. Go wild :-)
Comment #22
neoglez CreditAttribution: neoglez commentedOk! Let's go! ;)
Comment #23
infojunkieComment #24
neoglez CreditAttribution: neoglez commented...have to clean the patch (right indent) and maybe (it should be easy) add all functionalities from _plugin_exposed_form_required (just inheriting from the right class ).
Comment #25
neoglez CreditAttribution: neoglez commentedAs described in #24 -> Done!
This deserves to be commited.
...and coder is not complaining :-)
From this point on please file a bug, feature request, etc. report against the 7.x-1.x-dev version.
Comment #26
neoglez CreditAttribution: neoglez commentedCommited to 7.x-1.x.
Comment #27
alexbern CreditAttribution: alexbern commentedNeoglez, you rock!
Comment #28
Jerome F CreditAttribution: Jerome F commented+1 to certify to rock neoglez!
I opened new feature requests, following #16, to clarify the issue queue.
http://drupal.org/node/1184584
http://drupal.org/node/1184486
Comment #29
mhahndl CreditAttribution: mhahndl commented@neoglez: go wild further! :)
Comment #30
Bahlool CreditAttribution: Bahlool commentedsubscribe
Comment #31
JohnnyX CreditAttribution: JohnnyX commentedSubscribe.
Tested the dev release and get a white screen after during enabling "Views Selective Exposed Filters". So waiting for a working release and take a look at the issues here :)
Comment #32
neoglez CreditAttribution: neoglez commented@ JohnnyX Did you read #25
...
or #1188188: Fatal error: Only variables can be passed by reference
Comment #33
JohnnyX CreditAttribution: JohnnyX commentedI used the dev from project page which doesn't work but I don't know how I can download the dev module via git...
Comment #34
JohnnyX CreditAttribution: JohnnyX commentedAnd git clone the module doesn't work too...
This version is not compatible with Drupal 7.x and should be replaced.
Comment #35
JohnnyX CreditAttribution: JohnnyX commentedShould be wrong info file for D7 module...
Comment #36
neoglez CreditAttribution: neoglez commentedNO, you haven't, please read git docu.
Below the commit link where you can see what yopu posted in #35 was already fixed since tree weeks!
http://drupalcode.org/project/views_hacks.git/commitdiff/cbc24bfa59bc78d...
Comment #37
JohnnyX CreditAttribution: JohnnyX commentedI simple want to download views_hacks and not spend time in git... I read the version control tab page and cloned 7.x.1.x. Isn't up to date. No "update" command for git found. I'll wait for a new dev | stable release at d.o and maybe use the module later...
Thanks
Comment #38
Summit CreditAttribution: Summit commentedBookmarking, waiting for 7 dev projectpage release.
greetings, Martijn
Comment #39
bmango CreditAttribution: bmango commentedSubscribing - also waiting for 7 dev project page release.
I'm not 100% sure this is the right module for my situation. I have two exposed filter dropdowns, and want to make one dependent on the other. The second dropdown lists nodes that are tagged with taxonomy terms from the first dropdown. So when someone makes a selection with the first dropdown it automatically updates the second dropdown. Is this the right module for me?
Comment #40
neoglez CreditAttribution: neoglez commentedIt sounds possible if you know how to play with views. See a use case here
Comment #41
bmango CreditAttribution: bmango commentedThanks neoglez, that is an interesting use of filters, however I'm not sure if it fits my scenario. Many thanks for the link though.
Comment #42
cateye CreditAttribution: cateye commented+subscribe
Comment #43
cateye CreditAttribution: cateye commentedIt didn't work for me. I took a snapshot from Git. I installed the module (Drupal 7.7 - 7.x-3.0-rc1) and enabled it. Views showed the extra option for the filter. I also configured the exposed form to filter the results for the filter.
But the front-end didn't filter anything at all. It showed the full list.
Comment #44
JustMagicMaria CreditAttribution: JustMagicMaria commentedIt is close to working for me. Thank you very much, neoglez, for your work on this (and the original authors, of course). I am using 7.8 and the latest -dev of Views Hacks.
I changed my view's Exposed Form to Exposed form style: Selective Exposed Filters. In the Settings, I checked the "Limit values for the result set" checkbox for the taxonomy term reference field I was trying to limit.
I have two other exposed filters on this view that are not taxonomy terms.
When I enter the view, my select list for the taxonomy term field shows all values (even those not in the result set). When I enter a value in another filter (like "Name starts with"), then the taxonomy term filter shows only the values in the result. However, I get "An illegal choice has been detected. Please contact the site administrator."
Also, the "-Any-" choice has been removed. +1 on that feature request. I suspect that would solve this problem.
So close to working!!
Comment #45
neoglez CreditAttribution: neoglez commentedRight now i'm having a killing work time :(, soon i'll be updating in d.o.
Comment #46
doublejosh CreditAttribution: doublejosh commented... did anyone get this solved?
Comment #47
infojunkieI just committed an updated method for selective filters. It's completely different from the D6 method, and it it works well I will backport it to D6. Here's how it works:
The module now creates a new selective filter for every registered filter that it finds in the system, e.g. Node: title (selective). Select this filter instead of the original and expose it.
Please try it (12 hours from now or from git directly) and let me know how it works for you!
Comment #48
checker CreditAttribution: checker commentedThanks a lot for this update. The module looks like more stable than before. I don't know if it is a bug or missing feature: If you select a filter for an entity type that is not a node you will get pdo exceptions.
Comment #49
infojunkie@checker, please open a new issue describing the error that you get and attach the exported view. Ideally, the view would use nothing but core Drupal objects to allow me to reproduce the error.
Comment #51
doublejosh CreditAttribution: doublejosh commentedDoesn't seem to work with taxonomy.
Using with taxonomy all I get in the list is "Actual values will be available at run-time"
Tried all the forms* of taxonomy term available through the UI and with/without choosing "Limit list to selected items."
Using in conjunction with BEF.
Comment #52
doublejosh CreditAttribution: doublejosh commentedWhen used without BEF, the list is just empty.
Comment #53
infojunkiePlease open a new issue describing the problem you're having. This issue was created to request the porting of the module to D7.
Comment #54
doublejosh CreditAttribution: doublejosh commentedThanks. Done.
#1613358: Fatal error and bad query using selective filters with taxonomy terms.
Will thread BEF separately.
Comment #55
Dubs CreditAttribution: Dubs commentedFor me it works on Taxonomy terms BUT all that's shown in the drop down is the terms IDs and not the text. I've worked around this with a custom modules that replaces the text with hook_form_alter but there must be a more elegant way?