Commit b4c0a16a authored by alexpott's avatar alexpott

Issue #2345343 by damiankloip, dawehner, olli, Bès: view TITLE appears all the time

parent d07e48a6
......@@ -7,6 +7,8 @@
namespace Drupal\views\Tests\Plugin;
use Drupal\views\Views;
/**
* Tests the views page display plugin as webtest.
*
......@@ -19,7 +21,7 @@ class DisplayPageWebTest extends PluginTestBase {
*
* @var array
*/
public static $testViews = array('test_page_display_arguments', 'test_page_display_menu');
public static $testViews = array('test_page_display', 'test_page_display_arguments', 'test_page_display_menu');
/**
* Modules to enable.
......@@ -121,4 +123,15 @@ public function testPageDisplayMenu() {
$this->assertEqual((string) $menu_link[0], 'New title');
}
/**
* Tests the title is not displayed in the output.
*/
public function testTitleOutput() {
$this->drupalGet('test_page_display_200');
$view = Views::getView('test_page_display');
$xpath = $this->cssSelect('div.view:contains("' . $view->getTitle() . '")');
$this->assertFalse($xpath, 'The view title was not displayed in the view markup.');
}
}
......@@ -12,6 +12,7 @@ core: '8'
display:
default:
display_options:
title: 'Test page display'
defaults:
fields: false
pager: false
......
......@@ -28,6 +28,11 @@ function template_preprocess_views_view(&$variables) {
$variables['css_name'] = Html::cleanCssIdentifier($id);
$variables['id'] = $id;
$variables['display_id'] = $view->current_display;
// Override the title to be empty by default. For example, if viewing a page
// view, 'title' will already be populated in $variables. This can still be
// overridden to use a title when needed. See views_ui_preprocess_views_view()
// for an example of this.
$variables['title'] = '';
// Basic classes.
$variables['attributes']['class'] = array();
......
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