From 134643e6462e13654dc5e4ba5eef0dbecacd21f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Caruso?= Date: Sat, 5 May 2018 16:02:15 +0200 Subject: [PATCH] Issue #2969756 by maurizio.ganovelli: Facet must take in account only unit type bundles configured for datasource --- modules/bat_facets/bat_facets.module | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/bat_facets/bat_facets.module b/modules/bat_facets/bat_facets.module index 53fb6160e..661ac828d 100755 --- a/modules/bat_facets/bat_facets.module +++ b/modules/bat_facets/bat_facets.module @@ -49,10 +49,13 @@ function bat_facets_search_api_query_alter(QueryInterface &$query) { $valid_type_ids = []; - // We need to narrow the query to all Types with Units that have the - // requested state over the requested dates. + // We need to narrow the query to all unit types configured for this datasource + // with Units that have the requested state over the requested dates. // First, we retrieve all types. - $type_ids = bat_type_ids(); + $type_ids = []; + foreach (array_keys($datasource->getBundles()) as $bundle) { + $type_ids += bat_type_ids($bundle); + } foreach ($type_ids as $type_id => $name) { // Get the units of this type.