Problem/Motivation

If I attempt to install this module on a site running Group 3.x (in my case, specifically 3.0.0) certain admin pages, which are modified by Configuration Views, no longer load and instead throw the following error: "The website encountered an unexpected error. Please try again later."

Steps to reproduce

  1. Set up a new Drupal 10 site and install / configure the group module (3.x branch)
  2. Visit /admin/content (a view) and note the page loads fine
  3. Visit /admin/structure/types (not currently a view) and note the page loads fine
  4. Now install Configuration Views
  5. Visit /admin/content (a view) and note the page still loads fine
  6. Visit /admin/structure/types (NOW A VIEW) and note the page will not load
  7. You should see the message "The website encountered an unexpected error. Please try again later."
  8. The issue starts on line 372 in the group_views_query_alter function in group.module

More Details

For views provided by Drupal core, Line 372 sets the $view->build_info['query'] item properly. But for views provided by the Configuration Views module this line does nothing. The $view->build_info['query'] item remains an empty string. As a result, line 376 sets $query to an empty string for these views provided by the Configuration Views module. As a result, line 378 (where we attempt to call $query->addMetaData) fails.

Proposed resolution

Unsure how to fix. I'm not sure if the group module is making an assumption about the structure of the provided $view and $query parameters that isn't always true or if the new views provided by Configuration Views are not properly formatted.

Remaining tasks

Determine if the group code needs an update or if the Configuration Views module needs to alter the data structure for their views.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

https://www.drupal.org/project/group/issues/3358525

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

JayDarnell created an issue. See original summary.

monaw’s picture

I am having a very similar problem with Drupal 9.5.2, Group 3.0.1....

swirt’s picture

msielski made their first commit to this issue’s fork.

msielski’s picture

Looking into this I saw that config_views/src/Plugin/views/query/ConfigEntityQuery::build does not contain a few lines of code which views/src/Plugin/views/query/Sql::build contains. This missing code sets $view->build_info['query'] which is what was missing when group_views_query_alter runs. With the change in the linked MR, the reported issue seems to be fixed and can no longer be reproduced.

msielski’s picture

Status: Active » Needs review
anruether’s picture

Thank you for the MR, @msielski! It works for me, /admin/structure/types is available again.

edit: I use config_views in conjunction with content_model_documentation

mortona2k’s picture

Status: Needs review » Reviewed & tested by the community

I'm using this with content_model_documentation and group, and this fixes the error on admin pages for me.

It's a small change, explained well by the developer's comments above.

ultimike’s picture

This MR worked for me as well with Drupal core 10.3.9, Group module 3.3.0, and version 2.1.1 of this module.

-mike

scott_euser’s picture

If I understand this right, the issue comes when pagination is involved? Is that correct? Ie, not necessarily specific to Group module. Just want to consider how we can add test coverage for this.

scott_euser’s picture

scott_euser’s picture

Granting credit from related issue.

scott_euser’s picture

Version: 2.0.0 » 2.1.x-dev
Status: Reviewed & tested by the community » Needs review

Moving back to needs review for advice on #11 so I can understand how to add test coverage.

scott_euser’s picture

Status: Needs review » Fixed

Okay reproduced, added test coverage that fails without this (essentially mimicking what Group does)
Thanks all!

Status: Fixed » Closed (fixed)

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