@lizzie
To alter the query for a view in Drupal 8, you can use one of two approaches:
Here is an example of how to use hook_views_query_alter to add a condition to a view's query:
1 2 3 4 5 6 7 |
function mymodule_views_query_alter(ViewExecutable $view, QueryPluginBase $query) { // Check if the view is the one you want to alter. if ($view->id() == 'my_view') { // Add a condition to the view's query. $query->condition('table_name.field_name', 'value', '='); } } |
Keep in mind that the changes you make through the web interface will not be permanent, as they will be lost if the view is exported and reimported. To make your changes permanent, you will need to use one of the available approaches for exporting and importing views in Drupal 8, such as the views_ui module or the configuration management system.