Better way of getting applied filters?

Created on 20 October 2020, over 4 years ago
Updated 8 May 2025, 2 days ago

Problem/Motivation

The d7 version of this module got the views filters applied doing something like this:

$view = views_get_current_view();
$view->exposed_input;

However, a equivalent in Drupal 8, such as this, does not seem to work:

$view_id = \Drupal::routeMatch()->getParameter('view_id');
if ($view_id) {
  $view = View::load($view_id);
}
$view->exposed_input;

This seems to work, but it also feels brittle:

$params = $this->request->query->all()

Remaining tasks

Investigate potentially better methods to get the filters selected.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mtift Minnesota, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024