diff --git a/js/checkbox-widget.js b/js/checkbox-widget.js index 821424e..997aaca 100644 --- a/js/checkbox-widget.js +++ b/js/checkbox-widget.js @@ -51,8 +51,7 @@ }; /** - * Disable all facet links and checkboxes in the facet and apply a 'disabled' - * class. + * Disable all facet checkboxes in the facet and apply a 'disabled' class. */ Drupal.facets.disableFacet = function ($facet) { $facet.addClass('facets-disabled'); diff --git a/src/Plugin/facets/widget/CheckboxWidget.php b/src/Plugin/facets/widget/CheckboxWidget.php index a9f82a9..b22b4aa 100644 --- a/src/Plugin/facets/widget/CheckboxWidget.php +++ b/src/Plugin/facets/widget/CheckboxWidget.php @@ -2,13 +2,8 @@ namespace Drupal\facets\Plugin\facets\widget; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Link; -use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\facets\FacetInterface; -use Drupal\facets\Form\CheckboxWidgetForm; use Drupal\facets\Result\ResultInterface; -use Drupal\facets\Widget\WidgetInterface; /** * The checkbox / radios widget. @@ -22,6 +17,8 @@ use Drupal\facets\Widget\WidgetInterface; class CheckboxWidget extends LinksWidget { /** + * The facet the widget is being built for. + * * @var \Drupal\facets\FacetInterface */ protected $facet; @@ -61,6 +58,7 @@ class CheckboxWidget extends LinksWidget { ], ]; $build['#attached']['library'][] = 'facets/drupal.facets.checkbox-widget'; + return $build; } @@ -72,4 +70,5 @@ class CheckboxWidget extends LinksWidget { $items['#attributes']['data-facet-id'] = $this->facet->getUrlAlias() . '-' . $result->getRawValue(); return $items; } + } diff --git a/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php b/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php index dcd8031..8fc63da 100644 --- a/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php +++ b/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php @@ -85,7 +85,7 @@ class CheckboxWidgetTest extends UnitTestCase { /** * Build a formattable markup object to use in the other tests. * - * @param $text + * @param string $text * Text to display. * @param int $count * Number of results.