Skip to content

Commit 1d4e4c9

Browse files
committed
Added AC3 - design changes. This requires a particular branch of UI Kit.
1 parent 10efd8c commit 1d4e4c9

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

web/themes/contrib/civictheme/includes/views.inc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ function civictheme_preprocess_views_exposed_form(array &$variables): void {
162162
}
163163

164164
if ($field_count == 1) {
165+
// Use inline filter on search and auto pages if a single text field exsits.
166+
if (in_array($view->id(), ['civictheme_search', 'civictheme_automated_list'])) {
167+
$keyword_field = reset($fields);
168+
if ($keyword_field['#type'] === 'textfield') {
169+
$variables['inline_filter'] = TRUE;
170+
$variables['filter_items'] = $keyword_field;
171+
$submit_field = $variables['form']['actions']['submit'] ?? NULL;
172+
if (!empty($submit_field)) {
173+
$variables['submit_text'] = $submit_field['#value'] ?? '';
174+
}
175+
return;
176+
}
177+
}
178+
179+
// Use single filter.
165180
_civictheme_preprocess_views__exposed_form__single_filter($variables);
166181
}
167182
elseif ($field_count > 1) {

web/themes/contrib/civictheme/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/themes/contrib/civictheme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"dependencies": {
4141
"@popperjs/core": "^2.11.8",
42-
"@civictheme/uikit": "github:civictheme/uikit#fe12e68b86846b234df168e5a6c43d3442dd2d37"
42+
"@civictheme/uikit": "github:civictheme/uikit#9cd03e2f25e65c3236b07177d941f5cd17702a6b"
4343
},
4444
"devDependencies": {
4545
"@civictheme/scss-variables-extractor": "^0.2.1",

web/themes/contrib/civictheme/templates/views/views-exposed-form.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
form_attributes: form_attributes,
3030
form_suffix: form_suffix,
3131
} %}
32+
{% elseif inline_filter %}
33+
{% include 'civictheme:inline-filter' with {
34+
theme: theme,
35+
items: filter_items,
36+
} only %}
3237
{% else %}
3338
{{ form }}
3439
{% endif %}

0 commit comments

Comments
 (0)