In order to print a block in a twig file when using the Twig Tweak module you require the block id, but nothing I am trying will work and I get the message that -

This block is broken or missing. You may be missing content or you might need to enable the original module.

4 Answers 4


Assuming you are using Twig tweak 2.x the following drush command is suggested by the cheat sheet page.

drush ev "print_r(array_keys(\Drupal::service('plugin.manager.block')->getDefinitions()));"

I think your block id is a machine name of a block that you added here: Admin > Structure > Block layout (/admin/structure/block).

When you edit some block you will see the machine name. Besides, a disabled block is also allowed.

enter image description here


You can enable the debug mode for twig template, and then inspect the element. There are in comments with all the id of all the HTML elements. Check this

You enable Twig Debugging in sites/default/services.yml. (If services.yml does not yet exist; copy default.services.yml and copy it to services.yml.)

Set the debug variable to true. And clear cache.

    debug: true 
  • Thanks for this, but I have already got this debug mode working. And can not see anything specifically that states a block id, only template suggestions and the html id of the block, which I have tried also replacing the hyphens with underscores
    – drupalhgy
    Commented Apr 10, 2018 at 18:21
  • What about this link
    – ValRob
    Commented Apr 10, 2018 at 18:25

Unfortunately, block can mean a few things in the context of Drupal.

For the Twig Tweak module to render a block you need the numeric id of the block (most of the time - see above link). Navigate to /admin/structure/block/block-content. Edit the block you want. You can see the numeric block id in a couple places on the page but I like to look in the address bar (e.g. site.com/block/5). In this example the block id is 5.

So to render the block put the following in your twig template:

{{ drupal_entity('block_content', 5) }}

Alex Kuzava is kind of correct. That is the machine name of the block once it is placed in the block layout.

As a note there are a couple other ways to reference the block via twig tweak from the above reference link (e.g. by UUID).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.