_tracker_calculate_changed($node)
Picks the most recent timestamp between node changed and the last comment.
@todo Check if we should introduce 'language context' here, because the callers may need different timestamps depending on the users' language?
Parameters
\Drupal\node\NodeInterface $node: The node entity.
Return value
int The node changed timestamp, or most recent comment timestamp, whichever is the greatest.
File
- core/modules/tracker/tracker.module, line 294
- Tracks recent content posted by a user or users.
Code
function _tracker_calculate_changed($node) {
$changed = $node->getChangedTime();
$latest_comment = \Drupal::service('comment.statistics')->read(array($node), 'node', FALSE);
if ($latest_comment && $latest_comment->last_comment_timestamp > $changed) {
$changed = $latest_comment->last_comment_timestamp;
}
return $changed;
}
Please login to continue.