Same name and namespace in other branches
  1. 4.7.x includes/theme.inc \theme_block()
  2. 5.x includes/theme.inc \theme_block()
  3. 6.x developer/theme.php \theme_block()

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, $block->region, ...) and fields returned by <i>module</i>_block('view') ($block->subject, $block->content, ...).

Return value

A string containing the block output.

Related topics

1 theme call to theme_block()
theme_blocks in includes/theme.inc
Return a set of blocks available for the current user.

File

includes/theme.inc, line 721
The theme system, which controls the output of Drupal.

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;
}