How to set a filter when loading view?

There is a need to programmatically call view and add a filter.
Bring happened, but the condition is not triggered, displays all the elements in the view.

if ($variables["node"]->getType() == 'author') {
 $view = Views::getView('news_by_author');

 $args = array('field_author' => $variables["node"]->id());
 if (is_object($view)) {
$view->setArguments($args);
$view->setDisplay('page_1');
$view->preExecute();
$view->execute();

 $variables['author_articles'] = $view->buildRenderable('page_1', $args);
}
 }
April 7th 20 at 11:09
1 answer
April 7th 20 at 11:11
Solution
Has decided as follows:
if ($variables["node"]->getType() == 'author') {
 $view = Views::getView('news_by_author');

 if (is_object($view)) {
$view->setDisplay('page_1');
 $filters = $view->display_handler->getOption('filters');
 $filters["field_author_target_id"]["value"]["value"] = $variables["node"]->id();
 $view->display_handler->overrideOption('filters', $filters);
$view->preExecute();
$view->execute();

 $variables['author_articles'] = $view->buildRenderable('page_1');
}
 }

Find more questions by tags Drupal