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:

  1. Import the attached view (exported-view-with-exposed-group-filter.txt)
  2. 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.

Only local images are allowed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

daniel.rolls@flightcentre.com.au’s picture

Have solution will post shortly.

daniel.rolls@flightcentre.com.au’s picture

This 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.

daniel.rolls@flightcentre.com.au’s picture

Status: Active » Needs review
daniel.rolls@flightcentre.com.au’s picture

Issue summary: View changes

Adding screenshot.

dfranca’s picture

Issue summary: View changes
Status: Needs review » Needs work
FileSize
698 bytes

I tried using patch #3, and it led me to this error:

Fatal error: Cannot create references to/from string offsets nor overloaded objects

I changed it to this and it worked fine.

if ($this->multiple_exposed_input()) {
      if (!empty($options['group_info']['default_group_multiple'])) {
        $this->group_info = array_filter($options['group_info']['default_group_multiple']);
      }
      else {
        $this->group_info = NULL;
      }
timaholt’s picture

Status: Needs work » Needs review

Switching to needs review to get the testbot to run.

Status: Needs review » Needs work
skwashd’s picture

Status: Needs work » Needs review
FileSize
1.06 KB

Rerolled the patch so it applies cleanly. Switched from if else to sane default if.

markocall’s picture

The patch in #7 solved the issue for me, thanks skwashd

Darren Oh’s picture

It’s not necessary to set $this->group_info to NULL when it is unset to begin with. Simplified patch attached. Please review.

Darren Oh’s picture

Status: Needs review » Reviewed & tested by the community

$this->group_info does need to be set, so #7 is good to go.

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed, thank you very much! I don't thin this need to be moved to Drupal 8.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jenlampton’s picture

Status: Closed (fixed) » Needs work
FileSize
48.6 KB

When 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

Joel MMCC’s picture

I, 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

weekbeforenext’s picture

When 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.

defconjuan’s picture

I can confirm that the "solution" in #15 works.

arosboro’s picture

I had to select a default group (All) before the fix in 15 would apply...

shaktik’s picture

The patch in #7 solved the issue working fine for me, thanks @skwashd