We get the following warning/error when we import a View containing exposed grouped filters:
Notice: Undefined index: default_group_multiple in views_handler_filter->init() (line 94 of /var/docroot/web/docroot/sites/all/modules/contrib/views/handlers/views_handler_filter.inc).
To reproduce this error:
- Import the attached view (exported-view-with-exposed-group-filter.txt)
- You will see the warning messages come up.
To remove this warning message you can simply edit the Content: Title (grouped)
filter, and simply click Apply (all displays). However, we like to maintain a policy whereby Views UI is turned off in production environments, and all Views configuration is exported to code (to leverage re-visioning systems like GIT properly), so this is not an option.
The underlying issue seems to be related to the fact default_group_multiple information, is not exported nor imported with the exposed filter.
But for our purposes we do not require a default grouped filter item to be selected, so I would be happy to just see the warning messages removed by some basic checks.
Comment | File | Size | Author |
---|---|---|---|
#13 | residential.txt | 48.6 KB | jenlampton |
#7 | views-8236997-fatal-ref-fix-7.patch | 1.06 KB | skwashd |
exported-view-with-exposed-group-filter.txt | 4.54 KB | daniel.rolls@flightcentre.com.au |
Comments
Comment #1
daniel.rolls@flightcentre.com.au CreditAttribution: daniel.rolls@flightcentre.com.au commentedHave solution will post shortly.
Comment #2
daniel.rolls@flightcentre.com.au CreditAttribution: daniel.rolls@flightcentre.com.au commentedThis is my first patch (done the correct way on Drupal.org) so making it a simple one.
This simply tests if
$options['group_info']['default_group_multiple']
is set before using it.Comment #3
daniel.rolls@flightcentre.com.au CreditAttribution: daniel.rolls@flightcentre.com.au commentedComment #3.0
daniel.rolls@flightcentre.com.au CreditAttribution: daniel.rolls@flightcentre.com.au commentedAdding screenshot.
Comment #4
dfranca CreditAttribution: dfranca commentedI tried using patch #3, and it led me to this error:
I changed it to this and it worked fine.
Comment #5
timaholt CreditAttribution: timaholt commentedSwitching to needs review to get the testbot to run.
Comment #7
skwashd CreditAttribution: skwashd commentedRerolled the patch so it applies cleanly. Switched from if else to sane default if.
Comment #8
markocall CreditAttribution: markocall commentedThe patch in #7 solved the issue for me, thanks skwashd
Comment #9
Darren OhIt’s not necessary to set
$this->group_info
to NULL when it is unset to begin with. Simplified patch attached. Please review.Comment #10
Darren Oh$this->group_info
does need to be set, so #7 is good to go.Comment #11
dawehnerCommitted and pushed, thank you very much! I don't thin this need to be moved to Drupal 8.
Comment #13
jenlamptonWhen using the patch in #9 (with views 7.x-3.7) the views work fine when stored in the database, but after exporting to code I get the following error:
Fatal error: Cannot create references to/from string offsets nor overloaded objects in /drupal/includes/common.inc on line 6606
Views export attached for reference
Comment #14
Joel MMCC CreditAttribution: Joel MMCC commentedI, too, am getting #13 as reported by @jenlampton. Should this be a new Issue?
Edited to add: I made a new Issue for what @jenlampton and I are seeing:
#2207241: Exposed grouped filters gives “Fatal error: Cannot create references to/from string offsets nor overloaded objects” common.inc #6606
Comment #15
weekbeforenextWhen exporting/importing or adding to a feature, I get the following errors for these fields:
Notice: Undefined index: default_group_multiple in views_handler_filter->init() (line 94 of views/handlers/views_handler_filter.inc).
Warning: array_filter() expects parameter 1 to be array, null given in views_handler_filter->init() (line 94 of views/handlers/views_handler_filter.inc).
I just have to click on the affected filters and then click apply. When I save the view, the errors go away.
Comment #16
defconjuan CreditAttribution: defconjuan commentedI can confirm that the "solution" in #15 works.
Comment #17
arosboro CreditAttribution: arosboro commentedI had to select a default group (All) before the fix in 15 would apply...
Comment #18
shaktikThe patch in #7 solved the issue working fine for me, thanks @skwashd