Skip to content
Snippets Groups Projects
Commit 586b7ecd authored by Merlin Axel Rutz's avatar Merlin Axel Rutz Committed by Joris Vercammen
Browse files

Issue #3025534 by axel.rutz: Initially empty dropdown facet not dropdownified

parent 6a050417
No related branches found
No related tags found
No related merge requests found
...@@ -313,6 +313,11 @@ class DefaultFacetManager { ...@@ -313,6 +313,11 @@ class DefaultFacetManager {
$facet->setResults($results); $facet->setResults($results);
// We include this build even if empty, it may contain attached libraries.
/** @var \Drupal\facets\Widget\WidgetPluginInterface $widget */
$widget = $facet->getWidgetInstance();
$build = $widget->build($facet);
// No results behavior handling. Return a custom text or false depending on // No results behavior handling. Return a custom text or false depending on
// settings. // settings.
if (empty($facet->getResults())) { if (empty($facet->getResults())) {
...@@ -320,6 +325,7 @@ class DefaultFacetManager { ...@@ -320,6 +325,7 @@ class DefaultFacetManager {
if ($empty_behavior['behavior'] == 'text') { if ($empty_behavior['behavior'] == 'text') {
return [ return [
[ [
$build,
'#type' => 'container', '#type' => 'container',
'#attributes' => [ '#attributes' => [
'data-drupal-facet-id' => $facet->id(), 'data-drupal-facet-id' => $facet->id(),
...@@ -340,6 +346,7 @@ class DefaultFacetManager { ...@@ -340,6 +346,7 @@ class DefaultFacetManager {
// content. // content.
return [ return [
[ [
$build,
'#type' => 'container', '#type' => 'container',
'#attributes' => [ '#attributes' => [
'data-drupal-facet-id' => $facet->id(), 'data-drupal-facet-id' => $facet->id(),
...@@ -350,10 +357,7 @@ class DefaultFacetManager { ...@@ -350,10 +357,7 @@ class DefaultFacetManager {
} }
} }
/** @var \Drupal\facets\Widget\WidgetPluginInterface $widget */ return [$build];
$widget = $facet->getWidgetInstance();
return [$widget->build($facet)];
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment