Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -63,6 +63,13 @@ function tracker_page($account = NULL) {
|
|||
else {
|
||||
$nodes[$nid]->comment_count += $statistics->comment_count;
|
||||
}
|
||||
// Make the last comment timestamp reflect the latest comment.
|
||||
if (!isset($nodes[$nid]->last_comment_timestamp)) {
|
||||
$nodes[$nid]->last_comment_timestamp = $statistics->last_comment_timestamp;
|
||||
}
|
||||
else {
|
||||
$nodes[$nid]->last_comment_timestamp = max($nodes[$nid]->last_comment_timestamp, $statistics->last_comment_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
// Display the data.
|
||||
|
@ -75,25 +82,8 @@ function tracker_page($account = NULL) {
|
|||
$comments = 0;
|
||||
if ($node->comment_count) {
|
||||
$comments = $node->comment_count;
|
||||
|
||||
if ($new = \Drupal::service('comment.manager')->getCountNewComments($node)) {
|
||||
$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 />',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$mark_build = array(
|
||||
'#theme' => 'mark',
|
||||
'#status' => node_mark($node->id(), $node->getChangedTime()),
|
||||
);
|
||||
|
||||
$row = array(
|
||||
'type' => SafeMarkup::checkPlain(node_get_type_label($node)),
|
||||
'title' => array(
|
||||
|
@ -101,8 +91,9 @@ function tracker_page($account = NULL) {
|
|||
'#type' => 'link',
|
||||
'#url' => $node->urlInfo(),
|
||||
'#title' => $node->getTitle(),
|
||||
'#suffix' => ' ' . drupal_render($mark_build),
|
||||
),
|
||||
'data-history-node-id' => $node->id(),
|
||||
'data-history-node-timestamp' => $node->getChangedTime(),
|
||||
),
|
||||
'author' => array(
|
||||
'data' => array(
|
||||
|
@ -113,6 +104,7 @@ function tracker_page($account = NULL) {
|
|||
'comments' => array(
|
||||
'class' => array('comments'),
|
||||
'data' => $comments,
|
||||
'data-history-node-last-comment-timestamp' => $node->last_comment_timestamp,
|
||||
),
|
||||
'last updated' => array(
|
||||
'data' => t('!time ago', array(
|
||||
|
@ -148,5 +140,9 @@ function tracker_page($account = NULL) {
|
|||
$page['#cache']['tags'] = $cache_tags;
|
||||
$page['#cache']['contexts'][] = 'user.node_grants:view';
|
||||
|
||||
if (Drupal::moduleHandler()->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) {
|
||||
$page['#attached']['library'][] = 'tracker/history';
|
||||
}
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
|
Reference in a new issue