- 🇬🇧United Kingdom steven jones
Marking as a duplicate of 🐛 Batch mode does not allow other modules to alter query Needs review
Hi there
Have an issue where my view has a query_alter function attached
All it is doing is adding the addWhere clause, the function fires when the csv is being made but the CSV created does not have the filter applied, only the filters set in the view itself. It's as if the query used to create the CSV is the views setup one, not the altered item.
Example of what is not being applied to the csv (but is added to the query if you output the function)
function xxxx_common_views_query_alter(Drupal\views\ViewExecutable $view, Drupal\views\Plugin\views\query\Sql $query) {
if ($view->id() === 'search' && $view->current_display === 'data_export_1') {
// Get exposed user input.
$exposedInput = $view->getExposedInput();
if ($exposedInput['where_role'] == 'All') {
$group = count($query->where);
$query->addWhere($group, 'user__field_travel_preferences_value_0.field_travel_preferences_value', 'Remote', '=');
$query->addWhere($group, 'user__field_travel_preferences_value_0.field_travel_preferences_value', 'Local', '=');
}
}
}
Closed: duplicate
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Marking as a duplicate of 🐛 Batch mode does not allow other modules to alter query Needs review