-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Support for the facets_form module.
While rendering the facets_form_checkboxes facet widget provided by the facets_form module, groups facet checkboxes according to their LocalGov Directory facet type. This is similar to how the existing `checkbox` facet widget is rendered for LocalGov Directory facets. Resolves #326
- Loading branch information
Showing
6 changed files
with
153 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @file | ||
* Style rules for facets widgets from the facets_form module. | ||
*/ | ||
|
||
/** | ||
* Hides the submit buttons on an empty facets form. | ||
*/ | ||
.facet-empty ~ .form-actions { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
templates/checkboxes--localgov-directories-facets.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{# | ||
/** | ||
* @file | ||
* Default theme template for directory facet checkboxes. | ||
* | ||
* These checkboxes are used within the facets_form_checkbox facet widget. | ||
* | ||
* Available variables: | ||
* - title: Optional list title. | ||
* - grouped_options: checkboxes grouped by their corresponding LocalGov Directory facet type. Each group array contains: | ||
* - title: Label of the facet type. | ||
* - items: Checkbox element. | ||
* - weight: Sorting weight of the facet type. | ||
* - attributes: HTML attributes to be applied to the list. | ||
* | ||
* @see template_preprocess_checkboxes__localgov_directories_facets() | ||
*/ | ||
#} | ||
<div class="facets-widget facets-widget--facets-form-checkbox"> | ||
|
||
{%- if title is not empty -%} | ||
<h3>{{ title }}</h3> | ||
{%- endif -%} | ||
|
||
{% if grouped_options %} | ||
<ul{{ attributes }}> | ||
{%- for group_id, group_record in grouped_options -%} | ||
<li> | ||
<h4 class="facet-group__title">{{ group_record.title }}</h4> | ||
|
||
<ul{{ attributes.addClass('facet-filter-checkboxes') }}> | ||
{%- for checkbox in group_record.items -%} | ||
<li>{{ checkbox }}</li> | ||
{%- endfor -%} | ||
</ul> | ||
</li> | ||
{%- endfor -%} | ||
</ul> | ||
{%- endif %} | ||
</div> |