THEME_preprocess_block:
http://api.drupal.org/api/drupal/modules!block!block.module/function/template_preprocess_block/7
===
Question:
I'm not too satisfied that you call it by regions like: block--[region].tpl.php --
what if you had two or more blocks in the same region that needs to be styled differently?
In D6 you have block overrides that can take formats such as: block-views-events-block_1.tpl.php
However, in D7 the syntax is a little more restricted -- for more information see:
http://drupal.org/node/1089656
===
Past attempt: block--[region].tpl.php.
I tried doing a series of if, else statements based on: $block_id,
$id -- but these are not unique values to the block. I also tried $block->title,
and $block->delta in the if statement with no luck in this file.
===
Assistance from others:
spovlot: You could use THEME_preprocess_block.
spovlot: the function would be theme1_preprocess_block($vars)
spovlot: It handles all blocks
spovlot: You can put an if in your function to target the one block if you want
===
Ideas:
I. Do a php print_r [or use dsm()] structure to determine where the block name is stored (as well as to get variable name)..
II. Insert as many 'if' statements needed to target the specific blocks (using the determined value from I.)
Comments
Solution Found
We can create our own 'Custom block template suggestion'. Simply copy the 'THEME_preprocess_block()' into the 'template.php', then insert like the following:
$variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->region . '__' . $variables['block']->module . '_' . strtr($variables['block']->delta, '-', '_');Just make sure the you only have 3 items; that is, terms / variables (whatever you want to call it -- i.e. $variables['block']->region) surrounding two underscores (like the example above). Drupal will not let you have more than three terms / variables. But, you can cleverly name your hook suggestions with 'single underscore' as above.
You can certainly add custom suggestions to other entities other than blocks.