theme_block

Definition

theme_block($block)
drupal/includes/theme.inc, line 881

Description

Return a themed block.

You can style your blocks by defining .block (all blocks), .block-<i>module</i> (all blocks of module <i>module</i>), and \#block-<i>module</i>-<i>delta</i> (specific block of module <i>module</i> with delta <i>delta</i>) in your theme's CSS.

Parameters

$block An object populated with fields from the "blocks" database table ($block->module, $block->delta ...) and fields returned by <i>module</i>_block('view') ($block->subject, $block->content, ...).

Return value

A string containing the block output.

Related topics

Namesort iconDescription
Themeable functionsFunctions that display HTML, and which can be customized by themes.

Code

function theme_block($block) {
  $output  = "<div class=\"block block-$block->module\" id=\"block-$block->module-$block->delta\">\n";
  $output .= " <h2 class=\"title\">$block->subject</h2>\n";
  $output .= " <div class=\"content\">$block->content</div>\n";
  $output .= "</div>\n";
  return $output;
}