Issue #2102487 by vijaycs85, ACF: Add back in tab removed in [#1972990] and remove drupal_set_title() in tracker module controllers.
parent
77addbef6e
commit
e58427adf6
|
@ -28,6 +28,6 @@ class TrackerUserTab extends ControllerBase {
|
|||
* 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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,9 @@ class TrackerTest extends WebTestBase {
|
|||
$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'));
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'))
|
||||
|
|
Loading…
Reference in New Issue