I expect that some site builders will want to directly place a block instance in a Twig file (like page.twig.html) without making a theme-level region and/or using the Block UI. Combined with Twig's "extend" concept, direct block placement could be a very powerful way to do layout variation.

Here's a proof-of-concept gist that only deals with blocks. It could be abstracted to deal with entities of all types: https://gist.github.com/stevector/42c8f98a424fc0a0e1ee

Should such functionality go in core? It could be a very small contrib project.

Comments

stevector’s picture

In IRC Mark Carver suggesting doing this work in a contrib-fashion first. I will do so.

stevector’s picture

Here's a proof of concept as a contrib-style module https://github.com/stevector/twig_entity_embed

stevector’s picture

I have opened an issue in entity_embed module to ask about adding twig functionality. https://drupal.org/node/2279257

stevector’s picture

Status: Active » Closed (won't fix)

The pull request to entity_embed will likely go in at some point. With adding to contrib off the table I am closing this issue as won't fix.