Commit 517c3328 authored by catch's avatar catch

Issue #1972122 by akalata, mortendk, JamesLefrère, pakmanlh, ckrina, sun:...

Issue #1972122 by akalata, mortendk, JamesLefrère, pakmanlh, ckrina, sun: Remove the DIV tag around block content.
parent 3b6d1be1
......@@ -48,7 +48,7 @@ function testHtml() {
$this->assertFieldByXPath('//div[@id="block-test-html-block" and @data-custom-attribute="foo"]', NULL, 'HTML ID and attributes for test block are valid and on the same DOM element.');
// Ensure expected markup for a menu block.
$elements = $this->xpath('//div[contains(@class, :div-class)]/div/ul[contains(@class, :ul-class)]/li', array(':div-class' => 'block-system', ':ul-class' => 'menu'));
$elements = $this->xpath('//div[contains(@class, :div-class)]/ul[contains(@class, :ul-class)]/li', array(':div-class' => 'block-system', ':ul-class' => 'menu'));
$this->assertTrue(!empty($elements), 'The proper block markup was found.');
}
......
......@@ -86,11 +86,8 @@ public function testBasicRendering() {
$expected[] = '<div id="block-test-block1" class="block block-block-test">';
$expected[] = ' ';
$expected[] = ' ';
$expected[] = '';
$expected[] = ' <div class="content">';
$expected[] = ' ';
$expected[] = ' </div>';
$expected[] = '</div>';
$expected[] = ' ';
$expected[] = ' </div>';
$expected[] = '';
$expected_output = implode("\n", $expected);
$this->assertEqual(drupal_render($output), $expected_output);
......@@ -114,11 +111,8 @@ public function testBasicRendering() {
$expected[] = ' ';
$expected[] = ' <h2>Powered by Bananas</h2>';
$expected[] = ' ';
$expected[] = '';
$expected[] = ' <div class="content">';
$expected[] = ' ';
$expected[] = ' </div>';
$expected[] = '</div>';
$expected[] = ' ';
$expected[] = ' </div>';
$expected[] = '';
$expected_output = implode("\n", $expected);
$this->assertEqual(drupal_render($output), $expected_output);
......
......@@ -32,7 +32,6 @@
*
* @ingroup themeable
*/
@todo Remove the div around content as per http://drupal.org/node/1972122.
#}
{%
set classes = [
......@@ -46,10 +45,7 @@
<h2{{ title_attributes }}>{{ label }}</h2>
{% endif %}
{{ title_suffix }}
<div{{ content_attributes.addClass('content') }}>
{% block content %}
{{ content }}
{% endblock %}
</div>
{% block content %}
{{ content }}
{% endblock %}
</div>
......@@ -75,7 +75,7 @@ protected function doTestLanguageBlockAuthenticated($block_label) {
// Assert that each list item and anchor element has the appropriate data-
// attributes.
list($language_switcher) = $this->xpath('//div[@id=:id]/div[contains(@class, "content")]', array(':id' => 'block-test-language-block'));
list($language_switcher) = $this->xpath('//div[@id=:id]', array(':id' => 'block-test-language-block'));
$list_items = array();
$anchors = array();
$labels = array();
......@@ -125,7 +125,7 @@ protected function doTestLanguageBlockAnonymous($block_label) {
$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[contains(@class, "content")]', array(':id' => 'block-test-language-block'));
list($language_switcher) = $this->xpath('//div[@id=:id]', array(':id' => 'block-test-language-block'));
$links = array(
'active' => array(),
'inactive' => array(),
......
......@@ -115,7 +115,7 @@ function search_theme() {
function search_preprocess_block(&$variables) {
if ($variables['plugin_id'] == 'search_form_block') {
$variables['attributes']['role'] = 'search';
$variables['content_attributes']['class'][] = 'container-inline';
$variables['attributes']['class'][] = 'container-inline';
}
}
......
......@@ -143,7 +143,7 @@ public function testExposedBlock() {
$this->drupalGet('test_exposed_block');
// Test there is an exposed form in a block.
$xpath = $this->buildXPathQuery('//div[@id=:id]/div/form/@id', array(':id' => drupal_html_id('block-' . $block->id())));
$xpath = $this->buildXPathQuery('//div[@id=:id]/form/@id', array(':id' => drupal_html_id('block-' . $block->id())));
$this->assertFieldByXpath($xpath, $this->getExpectedExposedFormId($view), 'Expected form found in views block.');
// Test there is not an exposed form in the view page content area.
......
......@@ -132,6 +132,10 @@ function bartik_preprocess_block(&$variables) {
if ($variables['plugin_id'] == 'system_branding_block') {
$variables['attributes']['class'][] = 'clearfix';
}
// Add a container-inline class to keep consistent visual styles
if ($variables['plugin_id'] == 'search_form_block') {
$variables['content_attributes']['class'][] = 'container-inline';
}
}
/**
......
{#
/**
* @file
* Default theme implementation to display a block.
*
* Available variables:
* - plugin_id: The ID of the block implementation.
* - label: The configured label of the block if visible.
* - configuration: A list of the block's configuration values.
* - label: The configured label for the block.
* - label_display: The display settings for the label.
* - module: The module that provided this block plugin.
* - cache: The cache settings.
* - Block plugin specific settings will also be stored here.
* - block - The full block entity.
* - label_hidden: The hidden block title value if the block was
* configured to hide the title ('label' is empty in this case).
* - module: The module that generated the block.
* - delta: An ID for the block, unique within each module.
* - region: The block region embedding the current block.
* - content: The content of this block.
* - attributes: HTML attributes for the containing element.
* - id: A valid HTML ID and guaranteed unique.
* - 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
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*
* @see template_preprocess_block()
*
* @ingroup themeable
*/
#}
{%
set classes = [
'block',
'block-' ~ configuration.provider|clean_class,
]
%}
<div{{ attributes.addClass(classes) }}>
{{ title_prefix }}
{% if label %}
<h2{{ title_attributes }}>{{ label }}</h2>
{% endif %}
{{ title_suffix }}
{% block content %}
<div{{ content_attributes.addClass('content') }}>
{{ content }}
</div>
{% endblock %}
</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