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()->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.
field_get_itemsor entity metadata wrapper in D7. You'll want to use devel Kint for that and enable Twig debugging. You can also create a variable with a preprocess function just as always in your theme's .theme file and then leverage that with Twig syntax in the template file.