';
$expected[] = '';
$expected_output = implode("\n", $expected);
@@ -157,12 +159,14 @@ protected function renderTests() {
$entity->set('label', 'Powered by Bananas');
$output = entity_view($entity, 'block');
$expected = array();
- $expected[] = '
';
- $expected[] = '';
- $expected[] = '
Powered by Bananas
';
+ $expected[] = '
';
$expected[] = ' ';
- $expected[] = '
';
- $expected[] = '
';
+ $expected[] = '
Powered by Bananas
';
+ $expected[] = ' ';
+ $expected[] = '';
+ $expected[] = '
';
+ $expected[] = ' ';
+ $expected[] = '
';
$expected[] = '
';
$expected[] = '';
$expected_output = implode("\n", $expected);
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php
index 95f2cf1..be36f64 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php
@@ -51,11 +51,8 @@ function testBlockThemeHookSuggestions() {
'module' => $block->get('module'),
);
$variables['elements']['#children'] = '';
- // Test adding a class to the block content.
- $variables['content_attributes']['class'][] = 'test-class';
template_preprocess_block($variables);
$this->assertEqual($variables['theme_hook_suggestions'], array('block__system', 'block__system_menu_block', 'block__system_menu_block__menu_admin', 'block__machinename'));
- $this->assertEqual($variables['content_attributes']['class'], array('test-class', 'content'), 'Default .content class added to block content_attributes_array');
}
}
diff --git a/core/modules/block/templates/block.html.twig b/core/modules/block/templates/block.html.twig
new file mode 100644
index 0000000..f135bda
--- /dev/null
+++ b/core/modules/block/templates/block.html.twig
@@ -0,0 +1,41 @@
+{#
+/**
+ * @file
+ * Default theme implementation to display a block.
+ *
+ * Available variables:
+ * - label: The block title.
+ * - block - The full block entity.
+ * - block.label_hidden: The hidden block title value if the block was
+ * configured to hide the title ('label' is empty in this case).
+ * - block.module: The module that generated the block.
+ * - block.delta: An ID for the block, unique within each module.
+ * - block.region: The block region embedding the current block.
+ * - contents: The contents of this block.
+ * - attributes: Remaining HTML attributes for the containing element.
+ * - attributes.id: A valid HTML ID and guaranteed unique.
+ * - attributes.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-[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'.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_block()
+ *
+ * @ingroup themeable
+ */
+ @todo Remove the div around content as per http://drupal.org/node/1972122.
+#}
+
+ {{ title_prefix }}
+ {% if label %}
+
{{ label }}
+ {% endif %}
+ {{ title_suffix }}
+
+
+ {{ content }}
+
+
diff --git a/core/modules/block/templates/block.tpl.php b/core/modules/block/templates/block.tpl.php
deleted file mode 100644
index 4b301fa..0000000
--- a/core/modules/block/templates/block.tpl.php
+++ /dev/null
@@ -1,57 +0,0 @@
-label: Block title.
- * - $block->label_hidden: The hidden block title value if the block was
- * configured to hide the title ($block->label is empty in this case).
- * - $content: Block content.
- * - $block->module: Module that generated the block.
- * - $block->delta: An ID for the block, unique within each module.
- * - $block->region: The block region embedding the current block.
- * - $attributes: An instance of Attributes class that can be manipulated as an
- * array and printed as a string.
- * It includes the 'class' information, which includes:
- * - 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_prefix (array): An array containing additional output populated by
- * modules, intended to be displayed in front of the main title tag that
- * appears in the template.
- * - $title_suffix (array): An array containing additional output populated by
- * modules, intended to be displayed after the main title tag that appears in
- * the template.
- *
- * Helper variables:
- * - $is_front: Flags true when presented in the front page.
- * - $logged_in: Flags true when the current user is a logged-in member.
- * - $is_admin: Flags true when the current user is an administrator.
- * - $block_html_id: A valid HTML ID and guaranteed unique.
- *
- * @see template_preprocess()
- * @see template_preprocess_block()
- * @see template_process()
- *
- * @ingroup themeable
- */
-?>
-
-
>
-
-
>
-
-
-
-label): ?>
-
>label; ?>
-
-
-
-
>
-
-
-
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index d97dcf1..79a79ab 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -960,7 +960,7 @@ function _book_link_defaults($nid) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function book_preprocess_block(&$variables) {
if ($variables['block']-> module == 'book') {
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 5690c72..9e57a1d 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1556,7 +1556,7 @@ function comment_preview(Comment $comment) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function comment_preprocess_block(&$variables) {
if ($variables['block']->module == 'comment') {
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index eb2c1ec..9fd1b38 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -968,7 +968,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function forum_preprocess_block(&$variables) {
if ($variables['block']->module == 'forum') {
diff --git a/core/modules/help/help.module b/core/modules/help/help.module
index aac8636..ae9e841 100644
--- a/core/modules/help/help.module
+++ b/core/modules/help/help.module
@@ -68,7 +68,7 @@ function help_help($path, $arg) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function help_preprocess_block(&$variables) {
if ($variables['block']->id == 'system_help_block') {
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index 6bbb5a7..b4e9390 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -760,7 +760,7 @@ function language_language_delete($language) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function language_preprocess_block(&$variables) {
if ($variables['block']->module == 'language') {
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php
index ac834d1..7b36f92 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php
@@ -59,7 +59,7 @@ function testLanguageBlock() {
$this->assertText($block->label(), 'Language switcher block found.');
// Assert that only the current language is marked as active.
- list($language_switcher) = $this->xpath('//div[@id=:id]/div[@class="content"]', array(':id' => 'block-test-language-block'));
+ list($language_switcher) = $this->xpath('//div[@id=:id]/div[contains(@class, "content")]', array(':id' => 'block-test-language-block'));
$links = array(
'active' => array(),
'inactive' => array(),
diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module
index d13655e..3451e02 100644
--- a/core/modules/menu/menu.module
+++ b/core/modules/menu/menu.module
@@ -714,7 +714,7 @@ function menu_get_menus($all = TRUE) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function menu_preprocess_block(&$variables) {
if ($variables['block']->module == 'menu') {
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index f663387..018ea0e 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -1113,7 +1113,7 @@ function node_is_page(EntityInterface $node) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function node_preprocess_block(&$variables) {
if ($variables['block']->module == 'node') {
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index 25a04c7..a333180 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -485,7 +485,7 @@ function shortcut_renderable_links($shortcut_set = NULL) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function shortcut_preprocess_block(&$variables) {
if ($variables['block']->module == 'shortcut') {
diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module
index 66842a5..6499e73 100644
--- a/core/modules/statistics/statistics.module
+++ b/core/modules/statistics/statistics.module
@@ -234,7 +234,7 @@ function statistics_update_index() {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function statistics_preprocess_block(&$variables) {
if ($variables['block']->module == 'statistics') {
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index eee53b1..e76c4de 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2714,7 +2714,7 @@ function system_user_timezone(&$form, &$form_state) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function system_preprocess_block(&$variables) {
switch ($variables['block']->id) {
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index eddc8c3..2b8a467 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -668,7 +668,7 @@ function user_validate_current_pass(&$form, &$form_state) {
}
/**
- * Implements hook_preprocess_HOOK() for block.tpl.php.
+ * Implements hook_preprocess_HOOK() for block.html.twig.
*/
function user_preprocess_block(&$variables) {
if ($variables['block']->module == 'user') {