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.
Problem/Motivation
Create a node based view. Add a node type exposed filter having the settings as in the screenshot or attached test.
Save the view. Boom!!!
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#8 | views_grouped_filter-2595027-8.patch | 2.1 KB | Lendude |
views_filters_test.patch | 1.51 KB | claudiu.cristea | |
views_filters.png | 154.49 KB | claudiu.cristea |
Comments
Comment #3
Danny.Wouters CreditAttribution: Danny.Wouters as a volunteer commentedI will try to find a solution for the failed test.
Comment #4
Danny.Wouters CreditAttribution: Danny.Wouters as a volunteer commentedI am able to reproduce the issue but I have no idea what it is causing the problem.
Comment #5
UpTil4Music CreditAttribution: UpTil4Music as a volunteer commentedadded one node each of article and page
add content view
add filter criteria
--side issue bug? "Type - Content" shows up twice in the list (as do others) when filtering for "type", selected 1st instance
added filter, rolls to "Add filter criteria" dialog instead of "Configure filter criterion: Content: Type"
filter is added (type Unknown)
reselect filter to configure
selected three values per the issue
Apply - gives warning "The title is required if value for this item is defined."
Titles are now blank, were "1st, 2nd, 3rd" when submitted - what?
Added titles back - apply
Filter shows in preview
View filter works in preview
save - Boom!
Multiple error messages:
Location http://localhost:8080/admin/structure/views/view/2595027/preview/page_1?...
Referrer http://localhost:8080/admin/structure/views/view/2595027
Message User error: "preview" is an invalid render array key in Drupal\Core\Render\Element::children() (line 102 of /drupal/docroot/core/lib/Drupal/Core/Render/Element.php).
Location http://localhost:8080/admin/structure/views/view/2595027
Referrer http://localhost:8080/admin/structure/views/view/2595027
Message InvalidArgumentException: The configuration property display.default.display_options.filters.type.group_info.group_items.1.value.all doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 79 of /drupal/docroot/core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
Comment #6
UpTil4Music CreditAttribution: UpTil4Music as a volunteer commentedFollow up issue:
While playing around with this view to see what else I could find out, I noticed the first added option for the type value "Select all" didn't actually work on the view. The default
<Any>
works, as do the other two options. So I deleted the first option.Next, I tried to add another option to the list, but no option is added and I get an error message "An illegal choice has been detected. Please contact the site administrator." Details from the log:
mradcliffe thinks he has an uncommitted D7 views patch that may address the issue.
The json from http://localhost:8080/admin/structure/views/ajax/handler/2595027/page_1/... is:
Hope this helps!
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedAfter locally trying to reproduce this, I found the actual error in my php-fpm logs:
After removing the "select all" option, I get a similar error:
This basically means that Drupal is unable to store the grouped filter values, because it doesn't know how to do so. I'm not sure whether the key is wrong or if it simply doesn't exist.
Tagging so it hopefully gets on the radar of the views people.
Comment #8
LendudeThe problem seems to be that an array gets written to a field set to take a string value. That doesn't work. The other way around doesn't appear to be a problem though.
Manually tested this with a filter trying to set an array value (Node type) and a filter trying to set a string value (Node title), both worked manually. Lets see what the testbot thinks.
Comment #9
dawehnerIts so nice that we have a test already!
Comment #10
LendudeYeah, such luxury! But it does expose a follow-up issue, namely that you can apply the settings without actually selecting any checkboxes. The validation function feels that an array where all (or any actually) the values are 0 is a valid value.
But that's a different issue.
Comment #12
mradcliffeThe test fails exposed this, but this is a data model change, right? Does that mean it needs an update hook and all of the views configuration need to be changed?
Comment #13
Lendude@mradcliffe If this is the route we want to take to fixing this issue, then yeah I guess we need those things. No idea how to go about that though.
Tried to get the patch in the green by updating the config files currently in core but some of them don't want to play nice. Also, when I export a view config using config manager it seems to be using the old data model.
Comment #14
claudiu.cristea@dawehner, the "only test" patch was here since #0.
Comment #15
LendudeClosing this as a duplicate of #2369119: Fatal error when trying to save a View with grouped filters using other than string values, fix there looks better. Moved the test from #0 to that issue.
Comment #16
claudiu.cristeaHey, it's not about "looking better". This was the first report, this needs to stay and the other one is duplicate. If you feel that the other one is duplicating this, close that. Thank you
Comment #17
LendudeUhh in what date system is November 4, 2014 - 22:28 after October 16, 2015 - 19:27 ..... the other issue is almost a year older then this.
And it's all about fixing the issue not about who was first, so lets work on the patch that has done the most to fix the issue .... that's not this patch, but whatever.
Comment #18
claudiu.cristea@Lendude, ouch sorry. I didn't noticed the year :)
Comment #19
Lendude@claudiu.cristea no worries :-)
Just good to have all our efforts to fix this in one place, I don't really care where that is.