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"

Block types drupal hosting for me as

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.

spritefully yours
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

Watch this video!

Related articles

Custom search block drupal hostingPosted by Susan Rosie On May 26, 2015 2015-05-26T14:28:40+00:00 Drupal divides a web page in several regions, including sidebar, footer and header, which holds blocks for a display of various...
Hosting multiple sites drupal cmsDrupal made easy If you've decided that this is the content management system you want to use to create your site, why not also use your own perfect web address with it? Getting your website...
Red hen drupal hostingRedHen is a Drupal-native CRM initially designed for common nonprofit needs, but built for flexibility. It has classic CRM functionality for managing information about contacts, organizations,...
Tim millwood drupal hostingIts learning curve is notorious but Tim Millwood argues that Drupal is not that fearsome, and demonstrates how you can use it to build a job board Knowledge needed. Basic web development and...
Field instance drupal hostingWhen we go to the path /admin/structure/types/manage/article/fields and use Add new field option or Add existing field option, does that create a field or create field instance or attach field...