Commit 26aa196d authored by Dries's avatar Dries

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

parent 9d7070fd
......@@ -948,6 +948,9 @@ function template_preprocess_block(&$variables) {
$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']->module;
// Hyphens (-) and underscores (_) play a special role in theme suggestions.
......
......@@ -193,7 +193,7 @@ class BlockTestCase extends DrupalWebTestCase {
}
/**
* Test block visibility when using "pages" restriction but leaving
* Test block visibility when using "pages" restriction but leaving
* "pages" textarea empty
*/
function testBlockVisibilityListedEmpty() {
......@@ -747,7 +747,11 @@ class BlockTemplateSuggestionsUnitTest extends DrupalUnitTestCase {
$variables2 = array();
$variables2['elements']['#block'] = $block2;
$variables2['elements']['#children'] = '';
// Test adding a class to the block content.
$variables2['content_attributes_array']['class'][] = 'test-class';
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 (_)'));
// 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 @@
<?php endif;?>
<?php print render($title_suffix); ?>
<div class="content"<?php print $content_attributes; ?>>
<div<?php print $content_attributes; ?>>
<?php print $content ?>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment