diff --git a/core/modules/block/block.module b/core/modules/block/block.module index e9d9333..339d163 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -274,12 +274,6 @@ function template_preprocess_block(&$variables) { $variables['label'] = $variables['elements']['content']['#title']; } - $variables['attributes']['class'][] = 'block'; - $variables['attributes']['class'][] = drupal_html_class('block-' . $variables['configuration']['provider']); - - // Add default class for block content. - $variables['content_attributes']['class'][] = 'content'; - // Create a valid HTML ID and make sure it is unique. if (!empty($variables['elements']['#id'])) { $variables['attributes']['id'] = drupal_html_id('block-' . $variables['elements']['#id']); diff --git a/core/modules/block/src/Tests/BlockPreprocessUnitTest.php b/core/modules/block/src/Tests/BlockPreprocessUnitTest.php index 9118e21..5ae036a 100644 --- a/core/modules/block/src/Tests/BlockPreprocessUnitTest.php +++ b/core/modules/block/src/Tests/BlockPreprocessUnitTest.php @@ -50,7 +50,7 @@ function testBlockClasses() { // Test adding a class to the block content. $variables['content_attributes']['class'][] = 'test-class'; template_preprocess_block($variables); - $this->assertEqual($variables['content_attributes']['class'], array('test-class', 'content'), 'Default .content class added to block content_attributes'); + $this->assertEqual($variables['content_attributes']['class'], array('test-class'), 'Test-class class added to block content_attributes'); } } diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php index 6aa0f8b..8c9fb13 100644 --- a/core/modules/block/src/Tests/BlockViewBuilderTest.php +++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php @@ -83,7 +83,7 @@ public function testBasicRendering() { $entity = Block::load('test_block1'); $output = entity_view($entity, 'block'); $expected = array(); - $expected[] = '
'; + $expected[] = '
'; $expected[] = ' '; $expected[] = ' '; $expected[] = ''; @@ -110,7 +110,7 @@ public function testBasicRendering() { $entity->save(); $output = entity_view($entity, 'block'); $expected = array(); - $expected[] = '
'; + $expected[] = '
'; $expected[] = ' '; $expected[] = '

Powered by Bananas

'; $expected[] = ' '; diff --git a/core/modules/block/templates/block.html.twig b/core/modules/block/templates/block.html.twig index 3c51d46..8a14d0b 100644 --- a/core/modules/block/templates/block.html.twig +++ b/core/modules/block/templates/block.html.twig @@ -21,13 +21,6 @@ * - content: The content of this block. * - attributes: HTML attributes for the containing element. * - id: A valid HTML ID and guaranteed unique. - * - class: Classes that can be used to style contextually through - * CSS. These can be manipulated through preprocess functions. The default - * values can be one or more of the following: - * - block: The current template type, i.e., "theming hook". - * - block-[module]: The module generating the block. For example, the user - * module is responsible for handling the default user navigation block. - * In that case the class would be 'block-user'. * - title_attributes: HTML attributes for the title element. * - content_attributes: HTML attributes for the content element. * - title_prefix: Additional output populated by modules, intended to be @@ -41,14 +34,20 @@ */ @todo Remove the div around content as per http://drupal.org/node/1972122. #} - +{% + set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + ] +%} + {{ title_prefix }} {% if label %} {{ label }} {% endif %} {{ title_suffix }} - + {% block content %} {{ content }} {% endblock %}