- 30 views
Altering the query via custom module
In a .module file, using HOOK_views_query_alter() write the following:
use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\query\QueryPluginBase; function YOUR_MODULE_views_query_alter(ViewExecutable $view, QueryPluginBase $query) { // fix for node order duplicates if ($view->id() == 'VIEW_NAME') { $query->addWhereExpression(0,'taxonomy_index.tid = node__field_druh_materialu.field_druh_materialu_target_id'); } }
Replace node__field_druh_materialu.field_druh_materialu_target_id with a field you added as a taxonomy term reference field on nodes. In my case it was field_druh_materialu.