Hide view results with hook I am trying to not show a certain view result using hook_views_pre_render but I didn't find the correct way to not display the result.

I did manage to have access to the view and change each result title to a test title, code:

function MODULENAME_views_pre_render(\Drupal\views\ViewExecutable $view) {

  if($view-&gt;id() == 'tasks') {
    foreach($view-&gt;result as $task) {
      $task-&gt;_entity-&gt;set('title', 'test - ' . time());
    }
  }
}


I want to use something like $task->show = false;, is there any way?

Thank you!
Solved my problem with the following:

function MYMODULE_views_pre_render(\Drupal\views\ViewExecutable $view) {
  if($view-&gt;id() == 'tasks') {
    $i = 0;
    foreach($view-&gt;result as $value) {
      if($i == 2)
        unset($view-&gt;result[$i]);
      $i++;
    }
  }
 }


The code above does not show the 3rd result from the view results. Add logic as you need.