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

Conflicts:

	CHANGELOG.txt
merge-requests/26/head
David Rothstein 2016-10-02 14:26:12 -04:00
parent 03b241d5c0
commit 1b9379414d
7 changed files with 10 additions and 39 deletions

View File

@ -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.

View File

@ -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

View File

@ -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);
}
}

View File

@ -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']); ?>

View File

@ -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>

View File

@ -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); ?>

View File

@ -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); ?>