Commit 1b937941 authored by David_Rothstein's avatar David_Rothstein

Revert "Issue #578400 by tbradbury, therealssj, joshi.rohit100,...

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 2051d8c9.

Conflicts:

	CHANGELOG.txt
parent 03b241d5
...@@ -5,7 +5,6 @@ Drupal 7.51, xxxx-xx-xx (development version) ...@@ -5,7 +5,6 @@ Drupal 7.51, xxxx-xx-xx (development version)
used as an admin theme. used as an admin theme.
- Exceptions thrown in dblog_watchdog() are now caught and ignored. - Exceptions thrown in dblog_watchdog() are now caught and ignored.
- Clarified the warning that appears when modules are missing or have moved. - 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. - Log messages are now XSS filtered on display.
- Draggable tables do now work on touch screen devices. - Draggable tables do now work on touch screen devices.
- Added setting for allowing double underscores in CSS identifiers. - Added setting for allowing double underscores in CSS identifiers.
......
...@@ -2597,10 +2597,9 @@ function template_preprocess_html(&$variables) { ...@@ -2597,10 +2597,9 @@ function template_preprocess_html(&$variables) {
} }
// Construct page title. // Construct page title.
$title = drupal_get_title(); if (drupal_get_title()) {
if (strlen(trim($title))) {
$head_title = array( $head_title = array(
'title' => strip_tags($title), 'title' => strip_tags(drupal_get_title()),
'name' => check_plain(variable_get('site_name', 'Drupal')), 'name' => check_plain(variable_get('site_name', 'Drupal')),
); );
} }
...@@ -2699,8 +2698,7 @@ function template_process_page(&$variables) { ...@@ -2699,8 +2698,7 @@ function template_process_page(&$variables) {
$variables['breadcrumb'] = theme('breadcrumb', array('breadcrumb' => drupal_get_breadcrumb())); $variables['breadcrumb'] = theme('breadcrumb', array('breadcrumb' => drupal_get_breadcrumb()));
} }
if (!isset($variables['title'])) { if (!isset($variables['title'])) {
$title = drupal_get_title(); $variables['title'] = drupal_get_title();
$variables['title'] = strlen(trim($title)) ? $title : NULL;
} }
// Generate messages last in order to capture as many as possible for the // Generate messages last in order to capture as many as possible for the
......
...@@ -1943,32 +1943,6 @@ class NodeTitleTestCase extends DrupalWebTestCase { ...@@ -1943,32 +1943,6 @@ class NodeTitleTestCase extends DrupalWebTestCase {
// Test node title is clickable on teaser list (/node). // Test node title is clickable on teaser list (/node).
$this->drupalGet('node'); $this->drupalGet('node');
$this->clickLink($node->title); $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);
} }
} }
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<?php if ($site_name || $site_slogan): ?> <?php if ($site_name || $site_slogan): ?>
<div id="name-and-slogan"> <div id="name-and-slogan">
<?php if ($site_name): ?> <?php if ($site_name): ?>
<?php if (isset($title)): ?> <?php if ($title): ?>
<div id="site-name"><strong> <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> <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
</strong></div> </strong></div>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?> <?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a> <a id="main-content"></a>
<?php print render($title_prefix); ?> <?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 print render($title_suffix); ?>
<?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?> <?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?>
<?php print render($page['help']); ?> <?php print render($page['help']); ?>
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<div id="name-and-slogan"<?php if ($hide_site_name && $hide_site_slogan) { print ' class="element-invisible"'; } ?>> <div id="name-and-slogan"<?php if ($hide_site_name && $hide_site_slogan) { print ' class="element-invisible"'; } ?>>
<?php if ($site_name): ?> <?php if ($site_name): ?>
<?php if (isset($title)): ?> <?php if ($title): ?>
<div id="site-name"<?php if ($hide_site_name) { print ' class="element-invisible"'; } ?>> <div id="site-name"<?php if ($hide_site_name) { print ' class="element-invisible"'; } ?>>
<strong> <strong>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a> <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?> <?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a> <a id="main-content"></a>
<?php print render($title_prefix); ?> <?php print render($title_prefix); ?>
<?php if (isset($title)): ?> <?php if ($title): ?>
<h1 class="title" id="page-title"> <h1 class="title" id="page-title">
<?php print $title; ?> <?php print $title; ?>
</h1> </h1>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div id="header"> <div id="header">
<div id="logo-floater"> <div id="logo-floater">
<?php if ($logo || $site_title): ?> <?php if ($logo || $site_title): ?>
<?php if (isset($title)): ?> <?php if ($title): ?>
<div id="branding"><strong><a href="<?php print $front_page ?>"> <div id="branding"><strong><a href="<?php print $front_page ?>">
<?php if ($logo): ?> <?php if ($logo): ?>
<img src="<?php print $logo ?>" alt="<?php print $site_name_and_slogan ?>" title="<?php print $site_name_and_slogan ?>" id="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 @@ ...@@ -42,7 +42,7 @@
<a id="main-content"></a> <a id="main-content"></a>
<?php if ($tabs): ?><div id="tabs-wrapper" class="clearfix"><?php endif; ?> <?php if ($tabs): ?><div id="tabs-wrapper" class="clearfix"><?php endif; ?>
<?php print render($title_prefix); ?> <?php print render($title_prefix); ?>
<?php if (isset($title)): ?> <?php if ($title): ?>
<h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h1> <h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h1>
<?php endif; ?> <?php endif; ?>
<?php print render($title_suffix); ?> <?php print render($title_suffix); ?>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div id="branding" class="clearfix"> <div id="branding" class="clearfix">
<?php print $breadcrumb; ?> <?php print $breadcrumb; ?>
<?php print render($title_prefix); ?> <?php print render($title_prefix); ?>
<?php if (isset($title)): ?> <?php if ($title): ?>
<h1 class="page-title"><?php print $title; ?></h1> <h1 class="page-title"><?php print $title; ?></h1>
<?php endif; ?> <?php endif; ?>
<?php print render($title_suffix); ?> <?php print render($title_suffix); ?>
......
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