I want to remove certain entities from the view results (Views core module), before the view's pager is generated.
By now I am doing it in hook_views_post_execute(). The problem here is, that the number of results on the view pages is different then. There should be 10 results per page and not 7, 8 or 6 etc.
I do not want to create a views filter, which would require manual interaction from the user inside the views interface in the webbrowser.
I have tried also hook_views_query_alter(). The problem here is, that my module's class methods are processing entity id's (node id's in particular). It might would work with the SQL NOT IN statement, but this is probably a problem for bigger site's and a huge performance impact. Since I need to iterate over all entity id's from the site and check access then.
My questions:
- Is there any method inside the Views module, which allows me to remove the entity id's from the view results or shall I really use hook_views_query_alter()?
- Also - if it comes to the hook_views_X methods - isn't there any more elegant class method or event? Since hooks are a mostly deprecated way in Drupal 8.
Thanks for your attention!