diff --git a/core/modules/block/lib/Drupal/block/BlockRenderController.php b/core/modules/block/lib/Drupal/block/BlockRenderController.php index 74fc13c..9763193 100644 --- a/core/modules/block/lib/Drupal/block/BlockRenderController.php +++ b/core/modules/block/lib/Drupal/block/BlockRenderController.php @@ -72,11 +72,11 @@ public function view(EntityInterface $entity, $view_mode = 'full', $langcode = N public function viewMultiple(array $entities = array(), $view_mode = 'full', $langcode = NULL) { $build = array(); foreach ($entities as $entity_id => $entity) { - $build[$entity_id] = $entity->getPlugin()->build(); // Allow blocks to be empty, do not add in the defaults. - if (!empty($build[$entity_id])) { - $build[$entity_id] = $this->getBuildDefaults($entity, $view_mode, $langcode) + $build[$entity_id]; + if ($content = $entity->getPlugin()->build()) { + $build[$entity_id] = $this->getBuildDefaults($entity, $view_mode, $langcode); } + $build[$entity_id]['content'] = $content; // All blocks, even when empty, should be available for altering. $id = str_replace(':', '__', $entity->get('plugin')); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php index e0d37da..ed2f280 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php @@ -15,11 +15,6 @@ class BlockHtmlIdTest extends WebTestBase { /** - * An administrative user to configure the test environment. - */ - protected $adminUser; - - /** * Modules to enable. * * @var array @@ -37,15 +32,14 @@ public static function getInfo() { function setUp() { parent::setUp(); - // Create an admin user, log in and enable test blocks. - $this->adminUser = $this->drupalCreateUser(array('administer blocks', 'access administration pages')); - $this->drupalLogin($this->adminUser); + $this->drupalLogin($this->root_user); // Make sure the block has some content so it will appear. $current_content = $this->randomName(); state()->set('block_test.content', $current_content); - // Enable our test block. + // Enable our test blocks. + $this->drupalPlaceBlock('system_menu_block:menu-tools'); $this->drupalPlaceBlock('test_html_id', array('machine_name' => 'test_id_block')); } @@ -55,6 +49,8 @@ function setUp() { function testHtmlId() { $this->drupalGet(''); $this->assertRaw('id="block-test-id-block"', 'HTML ID for test block is valid.'); + $elements = $this->xpath('//div[contains(@class, :div-class)]/div/ul[contains(@class, :ul-class)]/li', array(':div-class' => 'block-system', ':ul-class' => 'menu')); + $this->assertTrue(!empty($elements), 'The proper block markup was found.'); } } diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 6acb232..7e26d50 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -436,8 +436,8 @@ function menu_reset_item($link) { function menu_block_view_alter(array &$build, Block $block) { // Add contextual links for system menu blocks. if ($block->getPlugin() instanceof SystemMenuBlock) { - foreach (element_children($build) as $key) { - $build['#contextual_links']['menu'] = array('admin/structure/menu/manage', array($build[$key]['#original_link']['menu_name'])); + foreach (element_children($build['content']) as $key) { + $build['#contextual_links']['menu'] = array('admin/structure/menu/manage', array($build['content'][$key]['#original_link']['menu_name'])); } } } diff --git a/core/modules/openid/openid.module b/core/modules/openid/openid.module index 426c8ae..ca3d968 100644 --- a/core/modules/openid/openid.module +++ b/core/modules/openid/openid.module @@ -166,15 +166,15 @@ function openid_user_logout($account) { */ function openid_block_view_user_login_block_alter(&$build, $block) { // Only alter the block when it is non-empty, i.e. when no user is logged in. - if (!isset($build['user_login_form'])) { + if (!isset($build['content']['user_login_form'])) { return; } - $build['openid_login_form'] = drupal_get_form('openid_login_form'); - $build['openid_login_form']['openid_identifier']['#size'] = $build['user_login_form']['name']['#size']; + $build['content']['openid_login_form'] = drupal_get_form('openid_login_form'); + $build['content']['openid_login_form']['openid_identifier']['#size'] = $build['content']['user_login_form']['name']['#size']; // Put an OpenID link as a first element. - $build['user_links']['#items'] = array( + $build['content']['user_links']['#items'] = array( l(t('Log in using OpenID'), 'user/login/openid', array( 'attributes' => array( 'title' => t('Log in using OpenID.'), @@ -183,10 +183,10 @@ function openid_block_view_user_login_block_alter(&$build, $block) { 'tabindex' => 0, ), )) - ) + $build['user_links']['#items']; + ) + $build['content']['user_links']['#items']; // Move links under the openid form. - $build['user_links']['#weight'] = 10; + $build['content']['user_links']['#weight'] = 10; } /**