diff --git a/core/modules/tracker/lib/Drupal/tracker/Controller/TrackerUserTab.php b/core/modules/tracker/lib/Drupal/tracker/Controller/TrackerUserTab.php index cb595f75238cf8b5fc5fb9b72cf426d25e32c561..49a75749dd33638b44c8c110befbe47526f6e870 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Controller/TrackerUserTab.php +++ b/core/modules/tracker/lib/Drupal/tracker/Controller/TrackerUserTab.php @@ -28,6 +28,6 @@ public function getContent(UserInterface $user) { * Title callback for the tracker.user_tab route. */ public function getTitle(UserInterface $user) { - return String::checkPlain(user_format_name($user)); + return String::checkPlain($user->getUsername()); } } diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php index 0abd95e13a05a7a962de4bb2c15b2c343ade2e80..e1895f462be3d8bd0820759c38cb2dc51c2e2fc4 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php @@ -118,6 +118,9 @@ function testTrackerUser() { $this->assertText($my_published->label(), "Published nodes show up in the user's tracker listing."); $this->assertNoText($other_published_no_comment->label(), "Other user's nodes do not show up in the user's tracker listing."); $this->assertText($other_published_my_comment->label(), "Nodes that the user has commented on appear in the user's tracker listing."); + // Verify that title and tab title have been set correctly. + $this->assertText('Track', 'The user tracker tab has the name "Track".'); + $this->assertTitle(t('@name | @site', array('@name' => $this->user->getUsername(), '@site' => \Drupal::config('system.site')->get('name'))), 'The user tracker page has the correct page title.'); // Verify that unpublished comments are removed from the tracker. $admin_user = $this->drupalCreateUser(array('post comments', 'administer comments', 'access user profiles')); diff --git a/core/modules/tracker/tracker.local_tasks.yml b/core/modules/tracker/tracker.local_tasks.yml index 7600bd0b29d4475ae8168341028eec473a8ff383..8a0ab779002dafd0cec3c54ea3dafeabc1010f1a 100644 --- a/core/modules/tracker/tracker.local_tasks.yml +++ b/core/modules/tracker/tracker.local_tasks.yml @@ -8,3 +8,8 @@ tracker.users_recent_tab: title: 'My recent content' tab_root_id: tracker.page_tab class: '\Drupal\tracker\Plugin\Menu\UserTrackerTab' + +tracker.user_tab: + route_name: tracker.user_tab + tab_root_id: user.view + title: 'Track' diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index eeef432cc4170e6890004596b8d3dbcb207e024d..332d9ac939879a4cd32b0d59158306c4aa2cdaf1 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -17,19 +17,12 @@ * * @see tracker_menu() */ -function tracker_page($account = NULL, $set_title = FALSE) { +function tracker_page($account = NULL) { if ($account) { $query = db_select('tracker_user', 't') ->extend('Drupal\Core\Database\Query\PagerSelectExtender') ->addMetaData('base_table', 'tracker_user') ->condition('t.uid', $account->id()); - - if ($set_title) { - // When viewed from user/%user/track, display the name of the user - // as page title -- the tab title remains Track so this needs to be done - // here and not in the menu definition. - drupal_set_title(user_format_name($account)); - } } else { $query = db_select('tracker_node', 't', array('target' => 'slave'))