diff --git a/core/modules/tracker/src/Tests/TrackerTest.php b/core/modules/tracker/src/Tests/TrackerTest.php index d1896fb0069764441e85381b7502f59f164ca90d..c593fc4c22537f3da96302e1152af6bc96703d47 100644 --- a/core/modules/tracker/src/Tests/TrackerTest.php +++ b/core/modules/tracker/src/Tests/TrackerTest.php @@ -112,6 +112,8 @@ function testTrackerUser() { $this->assertText($my_published->label(), "Published nodes show up in the user's tracker listing."); $this->assertNoText($other_published_no_comment->label(), "Another 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."); + $this->assertLink($my_published->label()); + $this->assertNoLink($unpublished->label()); // Verify that title and tab title have been set correctly. $this->assertText('Activity', 'The user activity tab has the name "Activity".'); $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.'); @@ -212,6 +214,7 @@ function testTrackerNewComments() { $this->drupalLogin($this->user); $this->drupalGet('activity'); $this->assertText('1 new', 'New comments are counted on the tracker listing pages.'); + $this->assertLink(t('1 new')); } /** diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index 1bebfbef280538a01a19ec41a0fd53af7e8487d0..c0077a354dee56e3e50f93372a70f7c1177ce180 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -73,8 +73,15 @@ function tracker_page($account = NULL) { $comments = $node->comment_count; if ($new = \Drupal::service('comment.manager')->getCountNewComments($node)) { - $comments .= '<br />'; - $comments .= \Drupal::l(format_plural($new, '1 new', '@count new'), $node->urlInfo()->setOptions(array('fragment' => 'new'))); + $comments = array( + '#type' => 'link', + '#url' => $node->urlInfo(), + '#title' => \Drupal::translation()->formatPlural($new, '1 new', '@count new'), + '#options' => array( + 'fragment' => 'new', + ), + '#prefix' => $node->comment_count . '<br />', + ); } } @@ -85,10 +92,29 @@ function tracker_page($account = NULL) { $row = array( 'type' => String::checkPlain(node_get_type_label($node)), - 'title' => array('data' => \Drupal::l($node->getTitle(), $node->urlInfo()) . ' ' . drupal_render($mark_build)), - 'author' => array('data' => array('#theme' => 'username', '#account' => $node->getOwner())), - 'replies' => array('class' => array('replies'), 'data' => $comments), - 'last updated' => array('data' => t('!time ago', array('!time' => \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $node->last_activity)))), + 'title' => array( + 'data' => array( + '#type' => 'link', + '#url' => $node->urlInfo(), + '#title' => $node->getTitle(), + '#suffix' => ' ' . drupal_render($mark_build), + ), + ), + 'author' => array( + 'data' => array( + '#theme' => 'username', + '#account' => $node->getOwner(), + ), + ), + 'replies' => array( + 'class' => array('replies'), + 'data' => $comments, + ), + 'last updated' => array( + 'data' => t('!time ago', array( + '!time' => \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $node->last_activity), + )), + ), ); $rows[] = $row;