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);
}
}
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');
}
}