It can crash in combination with other modules

Created on 16 October 2020, about 4 years ago
Updated 14 February 2023, almost 2 years ago

Problem/Motivation

The core_views_facets module may crash in combination to other modules; in my case the Groups module.

Background is the public function fillFacetsWithResults(array $facets) invokes a SQL-Query views_entity_query.

The group module has a hook that tries to alter the query, and get the entity_type from the queries metadata.

function group_query_entity_query_alter(SelectInterface $query) {
  $entity_type_id = $query->getMetaData('entity_type');

The metadata for the query are not correctly set, like in the many other queries that pass the same hook.

So I think it's a problem in the query mechanism of core_views_facets.

Steps to reproduce

1. Activate core_views_facets
2. Create a view (page) with exposed filters
3. Add facets for this page
4. Activate the group module
5. Load your page, no facet filters are shown

Proposed resolution

Set the correct metadata for the query that populates the facets

User error: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. 
in /var/www/my_install/webcore/lib/Drupal/Core/Entity/EntityTypeManager.php:150 
Stack trace: #0 /var/www/my_install/webmodules/contrib/group/group.module(246): 
Drupal\Core\Entity\EntityTypeManager->getDefinition() 
#1 /var/www/my_install/webmodules/contrib/group/group.module(260): group_query_entity_query_alter() 
#2 /var/www/my_install/webcore/lib/Drupal/Core/Extension/ModuleHandler.php(539): group_query_views_entity_query_alter() 
#3 /var/www/my_install/webcore/lib/Drupal/Core/Database/Query/Select.php(480): Drupal\Core\Extension\ModuleHandler->alter() 
#4 /var/www/my_install/webcore/lib/Drupal/Core/Database/Query/Select.php(505): Drupal\Core\Database\Query\Select->preExecute() 
#5 /var/www/my_install/webmodules/contrib/core_views_facets/src/Plugin/facets/facet_source/CoreViewsExposedFilter.php(174): Drupal\Core\Database\Query\Select->execute() 
#6 /var/www/my_install/webmodules/contrib/facets/src/FacetManager/DefaultFacetManager.php(374): Drupal\core_views_facets\Plugin\facets\facet_source\CoreViewsExposedFilter->fillFacetsWithResults() 
#7 /var/www/my_install/webmodules/contrib/facets/src/FacetManager/DefaultFacetManager.php(184): Drupal\facets\FacetManager\DefaultFacetManager->updateResults() 
#8 /var/www/my_install/webmodules/contrib/facets/src/FacetManager/DefaultFacetManager.php(270): Drupal\facets\FacetManager\DefaultFacetManager->processFacets() 
#9 /var/www/my_install/webmodules/contrib/facets/src/Plugin/Block/FacetBlock.php(83): Drupal\facets\FacetManager\DefaultFacetManager->build() 
#10 /var/www/my_install/webmodules/contrib/facets_block/src/Plugin/Block/FacetsBlock.php(204): Drupal\facets\Plugin\Block\FacetBlock->build() 
#11 /var/www/my_install/webmodules/contrib/facets_block/src/Plugin/Block/FacetsBlock.php(247): Drupal\facets_block\Plugin\Block\FacetsBlock->buildFacets() 
#12 /var/www/my_install/webcore/modules/block/src/BlockViewBuilder.php(171): Drupal\facets_block\Plugin\Block\FacetsBlock->build() 
#13 [internal function]: Drupal\block\BlockViewBuilder::preRender() 
#14 /var/www/my_install/webcore/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(100): call_user_func_array() 
#15 /var/www/my_install/webcore/lib/Drupal/Core/Render/Renderer.php(781): Drupal\Core\Render\Renderer->doTrustedCallback() 
#16 /var/www/my_install/webcore/lib/Drupal/Core/Render/Renderer.php(372): Drupal\Core\Render\Renderer->doCallback() 
#17 /var/www/my_install/webcore/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender() 
#18 /var/www/my_install/webcore/lib/Drupal/Core/Render/Renderer.php(156): Drupal\Core\Render\Renderer->render() 
#19 /var/www/my_install/webcore/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() 
#20 /var/www/my_install/webcore/lib/Drupal/Core/Render/Renderer.php(157): Drupal\Core\Render\Renderer->executeInRenderContext() 
#21 /var/www/my_install/webcore/lib/Drupal/Core/Render/Renderer.php(171): Drupal\Core\Render\Renderer->renderPlain() 
#22 /var/www/my_install/webcore/modules/big_pipe/src/Render/BigPipe.php(693): Drupal\Core\Render\Renderer->renderPlaceholder() 
#23 /var/www/my_install/webcore/modules/big_pipe/src/Render/BigPipe.php(547): Drupal\big_pipe\Render\BigPipe->renderPlaceholder() 
#24 /var/www/my_install/webcore/modules/big_pipe/src/Render/BigPipe.php(305): Drupal\big_pipe\Render\BigPipe->sendPlaceholders() 
#25 /var/www/my_install/webcore/modules/big_pipe/src/Render/BigPipeResponse.php(112): Drupal\big_pipe\Render\BigPipe->sendContent() 
#26 /var/www/my_install/apps/intranet/vendor/symfony/http-foundation/Response.php(374): Drupal\big_pipe\Render\BigPipeResponse->sendContent() 
#27 /var/www/my_install/webindex.php(20): Symfony\Component\HttpFoundation\Response->send() 
#28 {main} in Drupal\big_pipe\Render\BigPipe->sendPlaceholders() (Zeile 554 in /var/www/my_install/webcore/modules/big_pipe/src/Render/BigPipe.php) 
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany martinelkb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024