I have a view with an exposed taxonomy filter. I configured it to be displayed as a separate block so that I can print it another twig template. I tried this.
/**
* Implements hook_preprocess_block() for block.html.twig.
*/
function themename_preprocess_block(array &$variables) {
$variables['featured'] = views_embed_view('view_name', 'contextual_filter_block_machine_name');
}
Then I used {{ featured }}
in the block template, but it doesn't work.
Is there another way to do this?
themename
to be your theme's machine name? Also, can you run adebug(json_encode(views_embed_view('view_name', 'contextual_filter_block_machine_name')))
and then check the "Recent Log Reports" page?