Skip to content

Commit 76ee193

Browse files
febdaoalan-cole
authored andcommitted
[#3510578] Fixed CR.
1 parent 33f0509 commit 76ee193

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function civictheme_preprocess_views_view(array &$variables): void {
2121
_civictheme_preprocess_views_view__view($variables);
2222
_civictheme_preprocess_views_view__pager($variables);
2323
_civictheme_preprocess_views_view__search_page($variables);
24-
_civictheme_preprocess_views__selected_filters($variables);
24+
_civictheme_preprocess_views_view__selected_filters($variables);
2525
}
2626

2727
/**
@@ -254,8 +254,8 @@ function _civictheme_preprocess_views__exposed_form__group_filter(array &$variab
254254
/**
255255
* Preprocess views selected filters from the query params.
256256
*/
257-
function _civictheme_preprocess_views__selected_filters(array &$variables): void {
258-
$variables['selected_filters'] = _civictheme_automated_list__selected_filters();
257+
function _civictheme_preprocess_views_view__selected_filters(array &$variables): void {
258+
$variables['selected_filters'] = _civictheme_preprocess_views_view__selected_filters_list();
259259

260260
if (!empty($variables['selected_filters'])) {
261261
$variables['selected_filters_clear_link'] = [
@@ -278,9 +278,9 @@ function _civictheme_preprocess_views_view__search_page(array &$variables): void
278278
}
279279

280280
/**
281-
* Get an array of the active filters and format them for the selected filters.
281+
* Preprocess the selected filters list.
282282
*/
283-
function _civictheme_automated_list__selected_filters(): array {
283+
function _civictheme_preprocess_views_view__selected_filters_list(): array {
284284
$query_params = \Drupal::request()->query->all();
285285
$current_values = array_filter($query_params, function ($value) {
286286
return !empty($value);
@@ -292,9 +292,9 @@ function _civictheme_automated_list__selected_filters(): array {
292292
'topic',
293293
'title',
294294
'items_per_page',
295-
]; // Change this to get from $view there is an exposed input field or something that gives allowed exposed filters, pass $view in as argument to this function
296-
// this function should be called after the hook for changing view
297-
$selected_filters = [];
295+
];
296+
$selected_filters = [];
297+
298298
foreach ($current_values as $key => $value) {
299299
if (!in_array($key, $permitted_keys)) {
300300
continue;
@@ -304,7 +304,7 @@ function _civictheme_automated_list__selected_filters(): array {
304304
unset($new_query_params[$key]);
305305
$selected_filters[$key] = [
306306
'url' => \Drupal::request()->getUriForPath(\Drupal::request()->getPathInfo()) . '?' . http_build_query($new_query_params),
307-
'text' => _civictheme_automated_list__create_filter_label($key, $value),
307+
'text' => _civictheme_preprocess_views_view__selected_filters_list__create_filter_label($key, $value),
308308
];
309309
continue;
310310
}
@@ -318,7 +318,7 @@ function _civictheme_automated_list__selected_filters(): array {
318318
}
319319
$selected_filters[$key . '_' . $item . '_' . $value_key] = [
320320
'url' => \Drupal::request()->getUriForPath(\Drupal::request()->getPathInfo()) . '?' . http_build_query($temp_query_params),
321-
'text' => _civictheme_automated_list__create_filter_label($key, $item),
321+
'text' => _civictheme_preprocess_views_view__selected_filters_list__create_filter_label($key, $item),
322322
];
323323
}
324324
}
@@ -338,8 +338,7 @@ function _civictheme_automated_list__selected_filters(): array {
338338
* @return string
339339
* The formatted filter label.
340340
*/
341-
function _civictheme_automated_list__create_filter_label(string $key, string|int $value): string {
342-
// Get the value label.
341+
function _civictheme_preprocess_views_view__selected_filters_list__create_filter_label(string $key, string|int $value): string {
343342
switch ($key) {
344343
case 'type':
345344
// Get the type label from the node type.

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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)