diff --git a/src/Plugin/Block/FacetBlock.php b/src/Plugin/Block/FacetBlock.php index 3d22a3c..747f636 100644 --- a/src/Plugin/Block/FacetBlock.php +++ b/src/Plugin/Block/FacetBlock.php @@ -93,9 +93,6 @@ class FacetBlock extends BlockBase implements ContainerFactoryPluginInterface { ]; } - // Add facet group identifier. - $build['#attributes']['data-drupal-facet-id'] = $facet_id; - return $build; } diff --git a/src/Plugin/facets/widget/LinksWidget.php b/src/Plugin/facets/widget/LinksWidget.php index 19bd326..d8ee5a6 100644 --- a/src/Plugin/facets/widget/LinksWidget.php +++ b/src/Plugin/facets/widget/LinksWidget.php @@ -54,6 +54,7 @@ class LinksWidget implements WidgetInterface { $build = [ '#theme' => 'item_list', '#items' => $items, + '#attributes' => ['data-drupal-facet-id' => $facet->id()], '#cache' => [ 'contexts' => [ 'url.path', @@ -166,10 +167,7 @@ class LinksWidget implements WidgetInterface { * probably, a base class. */ public function buildConfigurationForm(array $form, FormStateInterface $form_state, $config) { - $widget_configs = []; - if (!is_null($config)) { - $widget_configs = $config->get('widget_configs'); - } + $widget_configs = !is_null($config) ? $config->get('widget_configs') : []; // Assure sane defaults. // @todo This should be handled upstream, in facet entity. Facet schema // should be fixed and all configs should get sane defaults.