From 1b9379414d94080b9a465bb32329b701a7a18633 Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Sun, 2 Oct 2016 14:26:12 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"Issue=20#578400=20by=20tbradbury,=20t?= =?UTF-8?q?herealssj,=20joshi.rohit100,=20aaronschachter,=20G=C3=A1bor=20H?= =?UTF-8?q?ojtsy,=20hgoto,=20melsi,=20er.pushpinderrana,=20valthebald,=20m?= =?UTF-8?q?w4ll4c3,=20Damien=20Tournoud,=20idflood,=20makbul=5Fkhan8,=20si?= =?UTF-8?q?gn,=20gvorbeck,=20amitgoyal,=20Sivaji,=20Cottser,=20dinarcon:?= =?UTF-8?q?=20Display=20the=20page=20title,=20even=20if=20"0""?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2051d8c94ee8dc050f132752fa9554fb567a70b6. Conflicts: CHANGELOG.txt --- CHANGELOG.txt | 1 - includes/theme.inc | 8 +++----- modules/node/node.test | 26 -------------------------- modules/system/page.tpl.php | 4 ++-- themes/bartik/templates/page.tpl.php | 4 ++-- themes/garland/page.tpl.php | 4 ++-- themes/seven/page.tpl.php | 2 +- 7 files changed, 10 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 202d1cad9ea..fa3dd35e78e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,7 +5,6 @@ Drupal 7.51, xxxx-xx-xx (development version) used as an admin theme. - Exceptions thrown in dblog_watchdog() are now caught and ignored. - Clarified the warning that appears when modules are missing or have moved. -- If the page title is "0", it is now displayed. - Log messages are now XSS filtered on display. - Draggable tables do now work on touch screen devices. - Added setting for allowing double underscores in CSS identifiers. diff --git a/includes/theme.inc b/includes/theme.inc index 8f929ac2142..9b606e9fb19 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2597,10 +2597,9 @@ function template_preprocess_html(&$variables) { } // Construct page title. - $title = drupal_get_title(); - if (strlen(trim($title))) { + if (drupal_get_title()) { $head_title = array( - 'title' => strip_tags($title), + 'title' => strip_tags(drupal_get_title()), 'name' => check_plain(variable_get('site_name', 'Drupal')), ); } @@ -2699,8 +2698,7 @@ function template_process_page(&$variables) { $variables['breadcrumb'] = theme('breadcrumb', array('breadcrumb' => drupal_get_breadcrumb())); } if (!isset($variables['title'])) { - $title = drupal_get_title(); - $variables['title'] = strlen(trim($title)) ? $title : NULL; + $variables['title'] = drupal_get_title(); } // Generate messages last in order to capture as many as possible for the diff --git a/modules/node/node.test b/modules/node/node.test index 8ec01a41f65..e8eb459e3bb 100644 --- a/modules/node/node.test +++ b/modules/node/node.test @@ -1943,32 +1943,6 @@ class NodeTitleTestCase extends DrupalWebTestCase { // Test node title is clickable on teaser list (/node). $this->drupalGet('node'); $this->clickLink($node->title); - - // Test edge cases. - // When node title is set to 0, the title should be '0'. - $node = $this->drupalCreateNode(array('title' => '0')); - $this->drupalGet('node/' . $node->nid); - $this->assertTitle('0' . ' | Drupal', 'Page title is equal to 0.', 'Node'); - // Test that 0 appears in the template

. - $xpath = '//h1[@id="page-title"]'; - $this->assertEqual(trim(current($this->xpath($xpath))), - '0', - 'Node title is displayed as 0.', - 'Node'); - - // When node title is empty string, the h1 doesn't show up. - $node = $this->drupalCreateNode(array('title' => '')); - $this->drupalGet('node/' . $node->nid); - $this->assertTitle('Drupal', '', 'Node'); - $xpath = '//h1[@id="page-title"]'; - $this->assertIdentical(count($this->xpath($xpath)), 0); - - // When node title is string with only spaces, the h1 doesn't show up. - $node = $this->drupalCreateNode(array('title' => ' ')); - $this->drupalGet('node/' . $node->nid); - $this->assertTitle('Drupal', '', 'Node'); - $xpath = '//h1[@id="page-title"]'; - $this->assertIdentical(count($this->xpath($xpath)), 0); } } diff --git a/modules/system/page.tpl.php b/modules/system/page.tpl.php index a844092dab1..bd61489e0f8 100644 --- a/modules/system/page.tpl.php +++ b/modules/system/page.tpl.php @@ -86,7 +86,7 @@
- +
@@ -126,7 +126,7 @@
-

+

diff --git a/themes/bartik/templates/page.tpl.php b/themes/bartik/templates/page.tpl.php index a9097645bdc..62f58d73e1f 100644 --- a/themes/bartik/templates/page.tpl.php +++ b/themes/bartik/templates/page.tpl.php @@ -99,7 +99,7 @@
> - +
> @@ -187,7 +187,7 @@
- +

diff --git a/themes/garland/page.tpl.php b/themes/garland/page.tpl.php index ae5b0c35528..326255cd4ef 100644 --- a/themes/garland/page.tpl.php +++ b/themes/garland/page.tpl.php @@ -8,7 +8,7 @@

diff --git a/themes/seven/page.tpl.php b/themes/seven/page.tpl.php index 32de3fbc725..6ab3ae8417c 100644 --- a/themes/seven/page.tpl.php +++ b/themes/seven/page.tpl.php @@ -2,7 +2,7 @@
- +