summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rothstein2016-10-02 18:26:12 (GMT)
committerDavid Rothstein2016-10-02 18:26:12 (GMT)
commit1b9379414d94080b9a465bb32329b701a7a18633 (patch)
treeed1a7619b08cd46e2bcd79c22d616c44643c2387
parent03b241d5c0addc6fe82f90e6fcb0d36d0cc58660 (diff)
Revert "Issue #578400 by tbradbury, therealssj, joshi.rohit100, aaronschachter, Gábor Hojtsy, hgoto, melsi, er.pushpinderrana, valthebald, mw4ll4c3, Damien Tournoud, idflood, makbul_khan8, sign, gvorbeck, amitgoyal, Sivaji, Cottser, dinarcon: Display the page title, even if "0""
This reverts commit 2051d8c94ee8dc050f132752fa9554fb567a70b6. Conflicts: CHANGELOG.txt
-rw-r--r--CHANGELOG.txt1
-rw-r--r--includes/theme.inc8
-rw-r--r--modules/node/node.test26
-rw-r--r--modules/system/page.tpl.php4
-rw-r--r--themes/bartik/templates/page.tpl.php4
-rw-r--r--themes/garland/page.tpl.php4
-rw-r--r--themes/seven/page.tpl.php2
7 files changed, 10 insertions, 39 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 202d1ca..fa3dd35 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 8f929ac..9b606e9 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 8ec01a4..e8eb459 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 <h1>.
- $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 a844092..bd61489 100644
--- a/modules/system/page.tpl.php
+++ b/modules/system/page.tpl.php
@@ -86,7 +86,7 @@
<?php if ($site_name || $site_slogan): ?>
<div id="name-and-slogan">
<?php if ($site_name): ?>
- <?php if (isset($title)): ?>
+ <?php if ($title): ?>
<div id="site-name"><strong>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
</strong></div>
@@ -126,7 +126,7 @@
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a>
<?php print render($title_prefix); ?>
- <?php if (isset($title)): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
+ <?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?>
<?php print render($page['help']); ?>
diff --git a/themes/bartik/templates/page.tpl.php b/themes/bartik/templates/page.tpl.php
index a909764..62f58d7 100644
--- a/themes/bartik/templates/page.tpl.php
+++ b/themes/bartik/templates/page.tpl.php
@@ -99,7 +99,7 @@
<div id="name-and-slogan"<?php if ($hide_site_name && $hide_site_slogan) { print ' class="element-invisible"'; } ?>>
<?php if ($site_name): ?>
- <?php if (isset($title)): ?>
+ <?php if ($title): ?>
<div id="site-name"<?php if ($hide_site_name) { print ' class="element-invisible"'; } ?>>
<strong>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
@@ -187,7 +187,7 @@
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a>
<?php print render($title_prefix); ?>
- <?php if (isset($title)): ?>
+ <?php if ($title): ?>
<h1 class="title" id="page-title">
<?php print $title; ?>
</h1>
diff --git a/themes/garland/page.tpl.php b/themes/garland/page.tpl.php
index ae5b0c3..326255c 100644
--- a/themes/garland/page.tpl.php
+++ b/themes/garland/page.tpl.php
@@ -8,7 +8,7 @@
<div id="header">
<div id="logo-floater">
<?php if ($logo || $site_title): ?>
- <?php if (isset($title)): ?>
+ <?php if ($title): ?>
<div id="branding"><strong><a href="<?php print $front_page ?>">
<?php if ($logo): ?>
<img src="<?php print $logo ?>" alt="<?php print $site_name_and_slogan ?>" title="<?php print $site_name_and_slogan ?>" id="logo" />
@@ -42,7 +42,7 @@
<a id="main-content"></a>
<?php if ($tabs): ?><div id="tabs-wrapper" class="clearfix"><?php endif; ?>
<?php print render($title_prefix); ?>
- <?php if (isset($title)): ?>
+ <?php if ($title): ?>
<h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
diff --git a/themes/seven/page.tpl.php b/themes/seven/page.tpl.php
index 32de3fb..6ab3ae8 100644
--- a/themes/seven/page.tpl.php
+++ b/themes/seven/page.tpl.php
@@ -2,7 +2,7 @@
<div id="branding" class="clearfix">
<?php print $breadcrumb; ?>
<?php print render($title_prefix); ?>
- <?php if (isset($title)): ?>
+ <?php if ($title): ?>
<h1 class="page-title"><?php print $title; ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>