Issue #1251188 by Sagar Ramgade, cam8001, MauHG, sag_13684, fenstrat, ruloweb, xjm: Fixed Set unique titles for user/register, user/password, and user/login menu items.
parent
f9afde4181
commit
b2bcf284df
|
@ -379,7 +379,7 @@ class BreadcrumbTest extends MenuTestBase {
|
|||
|
||||
// Verify breadcrumb on user pages (without menu link) for anonymous user.
|
||||
$trail = $home;
|
||||
$this->assertBreadcrumb('user', $trail, t('User account'));
|
||||
$this->assertBreadcrumb('user', $trail, t('Log in'));
|
||||
$this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $this->admin_user->name);
|
||||
|
||||
// Verify breadcrumb on user pages (without menu link) for registered users.
|
||||
|
|
|
@ -94,4 +94,37 @@ class UserAccountLinksTests extends WebTestBase {
|
|||
$this->assertEqual(count($link), 0, 'My account link is not in the secondary menu.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests page title is set correctly on user account tabs.
|
||||
*/
|
||||
function testAccountPageTitles() {
|
||||
// Default page titles are suffixed with the site name - Drupal.
|
||||
$title_suffix = ' | Drupal';
|
||||
|
||||
$this->drupalGet('user');
|
||||
$this->assertTitle('Log in' . $title_suffix, "Page title of /user is 'Log in'");
|
||||
|
||||
$this->drupalGet('user/login');
|
||||
$this->assertTitle('Log in' . $title_suffix, "Page title of /user/login is 'Log in'");
|
||||
|
||||
$this->drupalGet('user/register');
|
||||
$this->assertTitle('Create new account' . $title_suffix, "Page title of /user/register is 'Create new account' for anonymous users.");
|
||||
|
||||
$this->drupalGet('user/password');
|
||||
$this->assertTitle('Request new password' . $title_suffix, "Page title of /user/register is 'Request new password' for anonymous users.");
|
||||
|
||||
// Tests the default fallback title.
|
||||
$this->drupalGet('user/password/' . $this->randomString());
|
||||
$this->assertTitle('User account' . $title_suffix, "Fallback page title for user pages is 'User account' for anonymous users.");
|
||||
|
||||
// Check the page title for registered users is "My Account" in menus.
|
||||
$this->drupalLogin($this->drupalCreateUser());
|
||||
// After login, the client is redirected to /user.
|
||||
$link = $this->xpath('//a[contains(@class, :class)]', array(
|
||||
':class' => 'active-trail',
|
||||
)
|
||||
);
|
||||
$this->assertEqual((string) $link[0], 'My account', "Page title of /user is 'My Account' in menus for registered users");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1485,11 +1485,26 @@ function user_uid_optional_to_arg($arg) {
|
|||
/**
|
||||
* Menu item title callback for the 'user' path.
|
||||
*
|
||||
* Anonymous users should see "User account", but authenticated users are
|
||||
* expected to see "My account".
|
||||
* Anonymous users should see a title based on the requested page, but
|
||||
* authenticated users are expected to see "My account".
|
||||
*/
|
||||
function user_menu_title() {
|
||||
return user_is_logged_in() ? t('My account') : t('User account');
|
||||
if (!user_is_logged_in()) {
|
||||
switch (current_path()) {
|
||||
case 'user' :
|
||||
case 'user/login' :
|
||||
return t('Log in');
|
||||
case 'user/register' :
|
||||
return t('Create new account');
|
||||
case 'user/password' :
|
||||
return t('Request new password');
|
||||
default :
|
||||
return t('User account');
|
||||
}
|
||||
}
|
||||
else {
|
||||
return t('My account');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue