--- ../tmp/drupal_contextual_links-1304470-71.patch 2013-10-22 04:37:32.000000000 -0700 +++ ../tmp/drupal8.block-module.1304470-73.patch 2013-10-24 15:13:06.130459087 -0700 @@ -1,53 +1,54 @@ diff --git a/core/modules/block/block.module b/core/modules/block/block.module -index 6786cc0..12755d0 100644 +index 6786cc0..2f8b7ad 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module -@@ -455,6 +455,48 @@ function _block_get_renderable_block($element) { +@@ -455,6 +455,49 @@ function _block_get_renderable_block($element) { // Don't bother to build blocks that aren't accessible. if ($element['#access'] = $block->access()) { $element += entity_view($block, 'block'); + -+ // Render the block content if it has not been created already. -+ if (!isset($block->content)) { -+ $array = module_invoke($block->module, 'block_view', $block->delta); ++ // Render the block content if it has not been created already. ++ if (!isset($block->content)) { ++ $array = module_invoke($block->module, 'block_view', $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}_{$block->delta}"), $array, $block); ++ // 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}_{$block->delta}"), $array, $block); + -+ if (empty($array['content'])) { -+ // Blocks without content should emit no markup at all. -+ $element += array( -+ '#access' => FALSE, -+ '#printed' => TRUE, -+ ); -+ } -+ elseif (isset($array) && is_array($array)) { -+ foreach ($array as $k => $v) { -+ $block->$k = $v; ++ if (empty($array['content'])) { ++ // Blocks without content should emit no markup at all. ++ $element += array( ++ '#access' => FALSE, ++ '#printed' => TRUE, ++ ); ++ } ++ elseif (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 == '' ? '' : check_plain($block->title); -+ } ++ 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 == '' ? '' : check_plain($block->title); ++ } + -+ // Add the content renderable array to the main element. -+ $element['content'] = $block->content; -+ if (isset($block->content['#contextual_links'])) { -+ $element['#contextual_links'] = $block->content['#contextual_links']; ++ // Add the content renderable array to the main element. ++ $element['content'] = $block->content; ++ if (isset($block->content['#contextual_links'])) { ++ $element['#contextual_links'] = $block->content['#contextual_links']; ++ } ++ unset($block->content); ++ $element['#block'] = $block; + } -+ unset($block->content); -+ $element['#block'] = $block; } return $element; }