Problem/Motivation
Let's say we need to select a facet filter value by default. This approach works well with views:
```
function hook_views_pre_build(ViewsExecutable $view) {
$exposed = $view->getExposedInput();
$exposed['field_test']['25'] = 25; // // sets 25 as the default active value
$view->setExposedInput($exposed);
}
```
However, after debugging facets_exposed_filters, I noticed it only considers filters/values passed in the $_GET URL parameter: https://git.drupalcode.org/project/facets/-/blob/3.0.x/modules/facets_ex... . And, of course, this doesn’t work when AJAX is enabled.
Ideally, it should also take into account parameters from $view->getExposedInput()
Comments
Comment #2
dejan0 commentedComment #3
dejan0 commentedI also noticed that everything in $_GET is also available in $view->getExposedInput(), at least in my cases. Could we simply replace $_GET with $view->getExposedInput()?
Please find an attached patch.
Comment #5
strykaizerThanks!