Skip to content
Snippets Groups Projects
Commit 26aa196d authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #1286532 by andypost, rupl: () does not work for block default template.

parent 9d7070fd
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -948,6 +948,9 @@ function template_preprocess_block(&$variables) { ...@@ -948,6 +948,9 @@ function template_preprocess_block(&$variables) {
$variables['classes_array'][] = drupal_html_class('block-' . $variables['block']->module); $variables['classes_array'][] = drupal_html_class('block-' . $variables['block']->module);
// Add default class for block content.
$variables['content_attributes_array']['class'][] = 'content';
$variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->region; $variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->region;
$variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->module; $variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->module;
// Hyphens (-) and underscores (_) play a special role in theme suggestions. // Hyphens (-) and underscores (_) play a special role in theme suggestions.
......
...@@ -747,7 +747,11 @@ class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase { ...@@ -747,7 +747,11 @@ class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase {
$variables2 = array(); $variables2 = array();
$variables2['elements']['#block'] = $block2; $variables2['elements']['#block'] = $block2;
$variables2['elements']['#children'] = ''; $variables2['elements']['#children'] = '';
// Test adding a class to the block content.
$variables2['content_attributes_array']['class'][] = 'test-class';
template_preprocess_block($variables2); template_preprocess_block($variables2);
$this->assertEqual($variables2['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__hyphen_test'), t('Hyphens (-) in block delta were replaced by underscore (_)')); $this->assertEqual($variables2['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__hyphen_test'), t('Hyphens (-) in block delta were replaced by underscore (_)'));
// Test that the default class and added class are available.
$this->assertEqual($variables2['content_attributes_array']['class'], array('test-class', 'content'), t('Default .content class added to block content_attributes_array'));
} }
} }
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<?php endif;?> <?php endif;?>
<?php print render($title_suffix); ?> <?php print render($title_suffix); ?>
<div class="content"<?php print $content_attributes; ?>> <div<?php print $content_attributes; ?>>
<?php print $content ?> <?php print $content ?>
</div> </div>
</div> </div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment