You are here

protected function render_cache_hijack_context_reaction_block::build_block in Render cache 7

This is a shortened copy of _block_render_blocks().

Parameters

stdClass $block: A block object. $block->content and $block->subject will be filled in.

1 call to render_cache_hijack_context_reaction_block::build_block()
render_cache_hijack_context_reaction_block::block_list_build in modules/render_cache_context/context/plugins/render_cache_hijack_context_reaction_block.inc
A caching version of block_list() .

File

modules/render_cache_context/context/plugins/render_cache_hijack_context_reaction_block.inc, line 204

Class

render_cache_hijack_context_reaction_block

Code

protected function build_block($block) {
  $array = module_invoke($block->module, 'block_view', $block->delta);

  // Valid PHP function names cannot contain hyphens.
  $delta = str_replace('-', '_', $block->delta);

  // Allow modules to modify the block before it is viewed, via either
  // hook_block_view_alter() or hook_block_view_MODULE_DELTA_alter().
  drupal_alter(array(
    'block_view',
    "block_view_{$block->module}_{$delta}",
  ), $array, $block);
  if (isset($array) && is_array($array)) {
    foreach ($array as $k => $v) {
      $block->{$k} = $v;
    }
  }
  if (isset($block->content) && $block->content) {

    // Normalize to the drupal_render() structure.
    if (is_string($block->content)) {
      $block->content = array(
        '#markup' => $block->content,
      );
    }

    // Override default block title if a custom display title is present.
    if ($block->title) {

      // Check plain here to allow module generated titles to keep any
      // markup.
      $block->subject = $block->title == '<none>' ? '' : check_plain($block->title);
    }
    if (!isset($block->subject)) {
      $block->subject = '';
    }
  }
}