Block types drupal hosting
Hi. I need a help with Drupal 8 templates, please.
I created a custom block, I can create a theme for the custom block (the instance), but I can't create a theme for the Custom Block TYPE (let's call it "the prototype").
I meant, is there a way to theming the different Custom Block Types?
And a "bonus question": Why in the Theme Debug I can see "block--block-content.html.twig" twice? Should I see one "block--block-content.html.twig" and one "block--CUSTOM-BLOCK-TYPE-content.html.twig"
I'm running Drupal 8.1 stable.
Jeff Burnz commented 12 May 2016 at 22:15
By default there is no way to theme custom content block bundles (type), however for Adaptivetheme I developed a way that you can, and you can implement this in your theme.
This would give you the block template: block--bundle--the-prototype.html.twig
I can't answer the bonus question, suppose it's a bug. Notice I use array_splice() to slot the template suggestion in the array rather than pushing it on the end and overriding the template for the instance.
jrugel commented 20 May 2016 at 15:36
It worked for me. Thanks a lot.
germaike mv commented 2 November 2016 at 11:26
This works for me as well. nice work!
sprite commented 3 November 2016 at 07:38
Following for notes purposes.
Technical assistance provided to the Drupal community on my own time.
Thank yous appreciated.
Ismail Cherri commented 24 April 2017 at 13:31
Nice. Worked for me, thanks!
thomas.frobieter commented 16 May 2017 at 10:02
Worked for me too. Whyever this isn't already in core o.O
aburrows commented 18 May 2017 at 17:30
mmjvb commented 19 May 2017 at 02:32
mmjvb commented 19 May 2017 at 02:31
- test on BlockContentInterface
- adding suggestion at the end instead of inserting