summaryrefslogtreecommitdiff
path: root/modules/block
diff options
context:
space:
mode:
Diffstat (limited to 'modules/block')
-rw-r--r--modules/block/block.module4
-rw-r--r--modules/block/block.tpl.php12
2 files changed, 14 insertions, 2 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 8eb78e825..18a20af22 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -787,7 +787,9 @@ function template_preprocess_block(&$variables) {
$variables['block']->content = drupal_render($variables['block']->content);
}
+ $variables['classes_array'][] = 'block-' . $variables['block']->module;
+
$variables['template_files'][] = 'block-' . $variables['block']->region;
$variables['template_files'][] = 'block-' . $variables['block']->module;
$variables['template_files'][] = 'block-' . $variables['block']->module . '-' . $variables['block']->delta;
-} \ No newline at end of file
+}
diff --git a/modules/block/block.tpl.php b/modules/block/block.tpl.php
index 459a94034..c89d04ef3 100644
--- a/modules/block/block.tpl.php
+++ b/modules/block/block.tpl.php
@@ -11,8 +11,17 @@
* - $block->module: Module that generated the block.
* - $block->delta: An ID for the block, unique within each module.
* - $block->region: The block region embedding the current block.
+ * - $classes: String of classes that can be used to style contextually through
+ * CSS. It can be manipulated through the variable $classes_array from
+ * preprocess functions. The default values can be one or more of the following:
+ * - block: The current template type, i.e., "theming hook".
+ * - block-[module]: The module generating the block. For example, the user module
+ * is responsible for handling the default user navigation block. In that case
+ * the class would be "block-user".
*
* Helper variables:
+ * - $classes_array: Array of html class attribute values. It is flattened
+ * into a string within the variable $classes.
* - $block_zebra: Outputs 'odd' and 'even' dependent on each block region.
* - $zebra: Same output as $block_zebra but independent of any block region.
* - $block_id: Counter dependent on each block region.
@@ -23,9 +32,10 @@
*
* @see template_preprocess()
* @see template_preprocess_block()
+ * @see template_process()
*/
?>
-<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="block block-<?php print $block->module ?>">
+<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="<?php print $classes; ?>">
<?php if ($block->subject): ?>
<h2><?php print $block->subject ?></h2>
<?php endif;?>