diff --git a/src/Plugin/facets/widget/DropdownWidget.php b/src/Plugin/facets/widget/DropdownWidget.php index fb53ba8..d50e512 100644 --- a/src/Plugin/facets/widget/DropdownWidget.php +++ b/src/Plugin/facets/widget/DropdownWidget.php @@ -2,6 +2,7 @@ namespace Drupal\facets\Plugin\facets\widget; +use Drupal\Core\Form\FormStateInterface; use Drupal\facets\FacetInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; @@ -37,6 +38,7 @@ class DropdownWidget extends LinksWidget{ $configuration = $facet->getWidgetConfigs(); $this->showNumbers = empty($configuration['show_numbers']) ? FALSE : (bool) $configuration['show_numbers']; + $this->defaultOptionLabel = isset($configuration['default_option_label']) ? $configuration['default_option_label'] : ''; foreach ($results as $result) { if (is_null($result->getUrl())) { @@ -51,7 +53,7 @@ class DropdownWidget extends LinksWidget{ $build = [ '#theme' => 'item_list', '#items' => $items, - '#attributes' => ['class' => ['js-facets-dropdown-links'], 'data-facet-default-option-label' => $configuration['default_option_label']], + '#attributes' => ['class' => ['js-facets-dropdown-links'], 'data-facet-default-option-label' => $this->defaultOptionLabel], '#cache' => [ 'contexts' => [ 'url.path',