0

I installed the module "Shariff Social Media Buttons" for "Drupal 8" :

https://www.drupal.org/project/shariff

This module once installed, add a block in :

/admin/structure/block

I want to display this block in a template :

https://www.drupal.org/docs/8/modules/twig-tweak/rendering-blocks-with-twig-tweak

I tried with the following code :

{{ drupal_entity('block', shariffsharebuttons) }}

But the block does not work (it is not rendered on my page)

enter image description here

enter image description here

drush ev 'print_r(\Drupal::configFactory()->listAll("block.block."));'

enter image description here

closed as off-topic by leymannx, mradcliffe, kiamlaluno Nov 29 '18 at 9:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced, was solved by a cache clear, or was a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers." – leymannx, mradcliffe, kiamlaluno
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Just a wild guess, but: try using quotes around the block name {{ drupal_entity('block', 'shariffsharebuttons') }} – Hudri Nov 27 '18 at 19:35
  • @Hudri Yes that's right. Thank you. Drupal documentation is not correct – user90656 Nov 27 '18 at 19:44
  • shariffsharebuttons without quotes is a variable (which content is most likely empty, why you didn't get any result), while 'shariffsharebuttons' is a constant / a string value. The doc is not really wrong, they just didn't explain the Twig syntax. – Hudri Nov 27 '18 at 19:50
  • Docs seem to be correct. They also suggest {{ drupal_block('system_breadcrumb_block') }}. And they explicitly say: Note that the plugin_id needs to be wrapped in quotes. – leymannx Nov 27 '18 at 19:57
1

you can use Twig Tweak Module, will gives you twig extension called drupal_blockand you can render your block like the following :

{{ drupal_block('shariff_block') }}

Take a look to the module Cheat sheet for more info.

Note : Shariff Module provide block with the id shariff_block not shariffsharebuttons.