How to union two views and pass on arguments I want to union two views and pass on arguments from the first to the second view. Below is what I have so far. Not sure, if this is working. At least the bit to pass on arguments is still missing. Any ideas what I should put in the code?
use Drupal\views\Views;
use Drupal\views\ViewExecutable;

/**
 * Implements hook_views_pre_execute().
 */
function mymodule_views_pre_execute(ViewExecutable $view) {
  if ($view-&gt;id() == 'music_by_year' &amp;&amp; $view-&gt;current_display = 'block_2') {

    $view_by_author = Views::getView('music_by_author');
    $view_by_author-&gt;setDisplay('block_1');
    $view_by_author-&gt;build();

    $query_by_author = $view_by_author-&gt;build_info['query'];

    $query_by_year = &amp;$view-&gt;build_info['query'];
    $query_by_year-&gt;union($query_by_author);
  }
}
What you can do is to load and execute the $view_by_author view as you are doing but passing the by_year  arguments/contextual as this:
$arguments = [$view_by_year-&gt;build_info['parameter_you_need']];

$view_by_author = Views::getView('music_by_author');
$view_by_author-&gt;setArguments($arguments);
$view_by_author-&gt;setDisplay('block_1');
$view_by_author-&gt;preExecute();
$view_by_author-&gt;execute(); // or build, etc

I believe something like this would work for you.
Also, there is a module called Views Field View that might do what you are trying to do.