How to print anything in a twig template file In drupal 7 we were able to resort to simple php functions in tpl.php files to load anything we wanted. Entities, blocks, view etc. This was really powerful for making really customisable blocks. In D7 we can use this php: 

$block = block_load('views', 'block_name');      
$output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block   )))); 


When it comes to D8 I have read things about the getParameter but i'm coming up short on how to do it in a twig tpl.

For example, in a custom field in D8 I can get the node by using:

$node = \Drupal::routeMatch()-&gt;getParameter('node');


But how do I do this for a view on a page? And how would I do this in a twig.tpl in which you cannot write php?

I'm interested to see how people are tackling this in D8 or if I have the complete wrong method here.
better practice is to do that in preprocess functions !


so, fe. in preprocess page, you can access the node (if existing) via the $variables array and so on ..., then you add your own variables for the twig template, like:

$variables['my_fancy_block'] = \Drupal::service('renderer')-&gt;renderRoot($whatever);


and access this like:

{{ my_fancy_block }}