You are here

protected function render_cache_hijack_context_reaction_block::render_cache_block in Render cache 7

Render and cache a block.

Parameters

stdClass $block: A block object.

string $bid: The block id in $module-$delta format.

string $cid: The cache id.

array $cache_info: The cache information array.

Return value

string The rendered HTML for the block.

1 call to render_cache_hijack_context_reaction_block::render_cache_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 249

Class

render_cache_hijack_context_reaction_block

Code

protected function render_cache_block($block, $bid, $cid, $cache_info) {
  if (is_string($block->content)) {
    $block->content = array(
      '#markup' => $block->content,
    );
  }
  $build = $block->content;
  unset($block->content);
  $build += array(
    '#attached' => array(),
  );
  if ($bid != 'system-main' && $bid != 'system-help') {
    $build['#contextual_links']['block'] = array(
      'admin/structure/block/manage',
      array(
        $block->module,
        $block->delta,
      ),
    );
  }
  $build['#block'] = $block;
  $build['#theme_wrappers'][] = 'block';
  if (!empty($cid)) {
    $build['#cache'] = $cache_info;
    $build['#cache']['cid'] = $cid;
    return array(
      '#markup' => drupal_render($build),
      '#attached' => drupal_render_collect_attached($build, TRUE),
    );
  }
  return $build;
}