diff -u b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php --- b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php +++ b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php @@ -7,7 +7,6 @@ namespace Drupal\block; -use Drupal\Component\Utility\NestedArray; use Drupal\Core\Entity\EntityViewBuilderInterface; use Drupal\Core\Entity\EntityInterface; @@ -74,13 +73,11 @@ // #attributes and #contextual_links is information about the *entire* // block. Therefore, we must move these properties from $content and // merge them into the top-level element. - if (isset($content['#attributes'])) { - $build[$key]['#attributes'] = NestedArray::mergeDeep($build[$key]['#attributes'], $content['#attributes']); - unset($content['#attributes']); - } - if (isset($content['#contextual_links'])) { - $build[$key]['#contextual_links'] += $content['#contextual_links']; - unset($content['#contextual_links']); + foreach (array('#attributes', '#contextual_links') as $property) { + if (isset($content[$property])) { + $build[$key][$property] += $content[$property]; + unset($content[$property]); + } } $build[$key]['content'] = $content; } diff -u b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php --- b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\block\Tests\BlockHtmlIdTest. + * Definition of Drupal\block\Tests\BlockHtmlTest. */ namespace Drupal\block\Tests; @@ -12,7 +12,7 @@ /** * Tests block HTML ID validity. */ -class BlockHtmlIdTest extends WebTestBase { +class BlockHtmlTest extends WebTestBase { /** * Modules to enable. diff -u b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlBlock.php b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlBlock.php --- b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlBlock.php +++ b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestHtmlBlock.php @@ -7,6 +7,8 @@ namespace Drupal\block_test\Plugin\Block; +use Drupal\block\BlockBase; + /** * Provides a block to test HTML. *