Skip to content
Snippets Groups Projects
Commit f211e264 authored by Matthew Sielski's avatar Matthew Sielski Committed by Scott Euser
Browse files

Issue #3358929 by scott_euser, msielski, timotej-pl, shin.cho, maxstarkenburg:...

Issue #3358929 by scott_euser, msielski, timotej-pl, shin.cho, maxstarkenburg: Incompatible with Group 3.x
parent 50a77fbf
No related branches found
No related tags found
1 merge request!8Issue #3358929: Incompatible with Group 3.x
Pipeline #419042 passed
......@@ -150,6 +150,12 @@ class ConfigEntityQuery extends Sql {
$this->view = $view;
$view->initPager();
// Let the pager modify the query to add limits.
$view->pager->query();
$view->build_info['query'] = $this->query();
$view->build_info['count_query'] = $this->query(TRUE);
}
/**
......
<?php
/**
* @file
* Configuration Views Test module.
*/
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\query\QueryPluginBase;
/**
* Implements hook_views_query_alter().
*/
function config_views_test_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
// Here we mimic what Group module's group_views_query_alter() does to ensure
// that the query is available.
$table_info = $query->getEntityTableInfo();
$base_table = reset($table_info);
if (empty($base_table['entity_type'])) {
return;
}
// Add a custom tag so we don't trigger all other 'entity_query' tag alters.
$entity_type_id = $base_table['entity_type'];
// Build the Views query already so we can access the DB query.
$query->build($view);
$view->built = TRUE;
// Add metadata to the DB query.
// This is the bit that would fail previously as per
// https://www.drupal.org/project/config_views/issues/3358929.
$query = $view->build_info['query'];
$count_query = $view->build_info['count_query'];
$query->addMetaData('entity_type', $entity_type_id);
$count_query->addMetaData('entity_type', $entity_type_id);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment