public function CommentStatistics::getRankingInfo in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/src/CommentStatistics.php \Drupal\comment\CommentStatistics::getRankingInfo()
- 9 core/modules/comment/src/CommentStatistics.php \Drupal\comment\CommentStatistics::getRankingInfo()
File
- core/modules/comment/src/CommentStatistics.php, line 163
Class
- CommentStatistics
Namespace
Drupal\comment
Code
public function getRankingInfo() {
return [
'comments' => [
'title' => t('Number of comments'),
'join' => [
'type' => 'LEFT',
'table' => 'comment_entity_statistics',
'alias' => 'ces',
'on' => "ces.entity_id = i.sid AND ces.entity_type = 'node' AND ces.field_name = 'comment'",
],
'score' => '2.0 - 2.0 / (1.0 + ces.comment_count * (ROUND(:comment_scale, 4)))',
'arguments' => [
':comment_scale' => \Drupal::state()
->get('comment.node_comment_statistics_scale', 0),
],
],
];
}