By jonr on
Hi, I have regions on my frontpage with custom blocks (basic HTML) and custom template files for theming.
The problem is that I use block-based template files (block-block-5.tpl.php) with the block id in the name. But of course I can't guarantee that the block ID stays the same, so the theming could break.
Is there a way to change the template of a block inside specific region? Or is there a better way?
Comments
Block Class Module
Depending on what you are trying to achieve by theming each block, the Block Class module might help. It lets you easily format your blocks with CSS.
When you create a new block to be featured on the home page, you can enter a specific CSS class on the block's configuration page. So even though you are creating new blocks for your home page, you can format them the same as previous blocks that were in that region.
...
Block class module is a good suggestion and probably good fit for your use case, however to answer one of your questions directly - yes you can have block-region templates:
Block template suggestions are based on these factors and in this order:
1. block-module-delta.tpl.php
2. block-module.tpl.php
3. block-region.tpl.php
So your block-module-delta.tpl.php template (block-block-5.tpl.php) is going to override any block-region.tpl.php templates - something to be aware of.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.