Skip to content

Commit

Permalink
CIVIC-1449: Fixed automated list filter issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Amey Mudras committed Dec 5, 2023
1 parent bc7a342 commit 3e5c21e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions web/themes/contrib/civictheme/includes/automated_list.inc
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,23 @@ function _civictheme_automated_list__update_view(ViewExecutable $view): void {
$view->display_handler->setOption('row', $view_mode_options);
}

// @todo Implement hiding of the filters that were not selected.
$show_filters = !empty(array_filter(explode(', ', $settings['filters_exp'])));
if (!$show_filters) {
// Exposed filters.
$exposed_filter = explode(', ', $settings['filters_exp']);
$show_filters = !empty(array_filter($exposed_filter));

if ($show_filters) {
// Disable filters based on the component settings.
$view_filters = $view->display_handler->getOption('filters');
foreach ($view_filters as $key => $filter) {
if (isset($filter['exposed']) &&
$filter['exposed'] &&
!in_array($filter['expose']['identifier'], $exposed_filter)) {
unset($view_filters[$key]);
}
}
$view->display_handler->setOption('filters', $view_filters);
}
else {
$view->display_handler->has_exposed = FALSE;
}

Expand Down

0 comments on commit 3e5c21e

Please sign in to comment.