Commit 085791b5 authored by git's avatar git Committed by borisson_

Issue #2991562 by Jabb: Hide facet with 1 option on a date facet results in fatal error

parent 59f64069
......@@ -24,11 +24,14 @@ class HideOnlyOneItemProcessor extends ProcessorPluginBase implements BuildProce
* {@inheritdoc}
*/
public function build(FacetInterface $facet, array $results) {
if (count($results) === 1 && !$results[0]->isActive()) {
return [];
if (count($results) !== 1) {
return $results;
}
return $results;
/** @var \Drupal\facets\Result\Result $result */
$result = reset($results);
return $result->isActive() ? $results : [];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment