diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index a3566a5..4038557 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -247,12 +247,12 @@ function comment_permission() {
/**
* Calculates the page number for the first new comment.
*
- * @param int $num_comments
+ * @param int $total_comments_number
* The total number of comments that the entity has.
* @param int $new_comments
* The number of new comments that the entity has.
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
- * The entity that comments belong to.
+ * The entity to which the comments belong.
* @param string $field_name
* The field name on the entity to which comments are attached.
*
@@ -263,9 +263,9 @@ function comment_permission() {
* Use \Drupal\comment\CommentStorageInterface::getNewCommentPageNr();
* Note this returns an integer instead of array|null.
*/
-function comment_new_page_count($num_comments, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
+function comment_new_page_count($total_comments_number, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
$page_nr = \Drupal::entityManager()->getStorage('comment')
- ->getNewCommentPageNr($num_comments, $new_comments, $entity, $field_name);
+ ->getNewCommentPageNumber($total_comments_number, $new_comments, $entity, $field_name);
return $page_nr ? array('page' => $page_nr) : NULL;
}
diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php
index 40d2a07..45a54ac 100644
--- a/core/modules/comment/src/CommentStorage.php
+++ b/core/modules/comment/src/CommentStorage.php
@@ -119,17 +119,17 @@ public function getMaxThreadPerThread(CommentInterface $comment) {
/**
* {@inheritdoc}
*/
- public function getNewCommentPageNr($num_comments, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
+ public function getNewCommentPageNumber($total_comments_number, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
$instance = $entity->getFieldDefinition($field_name);
$comments_per_page = $instance->getSetting('per_page');
- if ($num_comments <= $comments_per_page) {
+ if ($total_comments_number <= $comments_per_page) {
// Only one page of comments.
$count = 0;
}
elseif ($instance->getSetting('default_mode') == CommentManagerInterface::COMMENT_MODE_FLAT) {
// Flat comments.
- $count = $num_comments - $new_comments;
+ $count = $total_comments_number - $new_comments;
}
else {
// Threaded comments.
diff --git a/core/modules/comment/src/CommentStorageInterface.php b/core/modules/comment/src/CommentStorageInterface.php
index d916b5b..a4cbb2b 100644
--- a/core/modules/comment/src/CommentStorageInterface.php
+++ b/core/modules/comment/src/CommentStorageInterface.php
@@ -41,19 +41,19 @@ public function getMaxThreadPerThread(CommentInterface $comment);
/**
* Calculates the page number for the first new comment.
*
- * @param int $num_comments
+ * @param int $total_comments_number
* The total number of comments that the entity has.
* @param int $new_comments
* The number of new comments that the entity has.
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
- * The entity that comments belong to.
+ * The entity to which the comments belong.
* @param string $field_name
* The field name on the entity to which comments are attached.
*
* @return array|null
* An array "page=X" if the page number is greater than zero; NULL otherwise.
*/
- public function getNewCommentPageNr($num_comments, $new_comments, ContentEntityInterface $entity, $field_name = 'comment');
+ public function getNewCommentPageNumber($total_comments_number, $new_comments, ContentEntityInterface $entity, $field_name = 'comment');
/**
* Gets the comment ids of the passed comment entities' children.
diff --git a/core/modules/comment/src/CommentViewBuilder.php b/core/modules/comment/src/CommentViewBuilder.php
index 06d66c3..440d8c2 100644
--- a/core/modules/comment/src/CommentViewBuilder.php
+++ b/core/modules/comment/src/CommentViewBuilder.php
@@ -338,7 +338,7 @@ public static function attachNewCommentsLinkMetadata(array $element, array $cont
$field_name = $context['field_name'];
$page_nr = \Drupal::entityManager()
->getStorage('comment')
- ->getNewCommentPageNr($entity->{$field_name}->comment_count, $new, $entity);
+ ->getNewCommentPageNumber($entity->{$field_name}->comment_count, $new, $entity);
$query = $page_nr ? array('page' => $page_nr) : NULL;
// Attach metadata.
diff --git a/core/modules/comment/src/Controller/CommentController.php b/core/modules/comment/src/Controller/CommentController.php
index 91368f3..a87b948 100644
--- a/core/modules/comment/src/Controller/CommentController.php
+++ b/core/modules/comment/src/Controller/CommentController.php
@@ -291,7 +291,7 @@ public function renderNewCommentsNodeLinks(Request $request) {
$node = node_load($nid);
$new = comment_num_new($node->id(), 'node');
$page_nr = $this->entityManager()->getStorage('comment')
- ->getNewCommentPageNr($node->{$field_name}->comment_count, $new, $node);
+ ->getNewCommentPageNumber($node->{$field_name}->comment_count, $new, $node);
$query = $page_nr ? array('page' => $page_nr) : NULL;
$links[$nid] = array(
'new_comment_count' => (int) $new,
diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
index c9a1fad..93a8b88 100644
--- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
@@ -152,7 +152,7 @@ protected function renderLink($data, ResultRow $values) {
'type' => $this->getValue($values, 'type'),
));
$page_nr = \Drupal::entityManager()->getStorage('comment')
- ->getNewCommentPageNr($this->getValue($values, 'comment_count'), $this->getValue($values), $node);
+ ->getNewCommentPageNumber($this->getValue($values, 'comment_count'), $this->getValue($values), $node);
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'node/' . $node->id();
$this->options['alter']['query'] = $page_nr ? array('page' => $page_nr) : NULL;
diff --git a/core/modules/comment/src/Tests/CommentPagerTest.php b/core/modules/comment/src/Tests/CommentPagerTest.php
index e81f8b8..b2f1865 100644
--- a/core/modules/comment/src/Tests/CommentPagerTest.php
+++ b/core/modules/comment/src/Tests/CommentPagerTest.php
@@ -247,7 +247,7 @@ function testCommentNewPageIndicator() {
$node = node_load($node->id());
foreach ($expected_pages as $new_replies => $expected_page) {
$returned_page = \Drupal::entityManager()->getStorage('comment')
- ->getNewCommentPageNr($node->get('comment')->comment_count, $new_replies, $node);
+ ->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node);
$this->assertIdentical($expected_page, $returned_page, format_string('Flat mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
}
@@ -266,7 +266,7 @@ function testCommentNewPageIndicator() {
$node = node_load($node->id());
foreach ($expected_pages as $new_replies => $expected_page) {
$returned_page = \Drupal::entityManager()->getStorage('comment')
- ->getNewCommentPageNr($node->get('comment')->comment_count, $new_replies, $node);
+ ->getNewCommentPageNumber($node->get('comment')->comment_count, $new_replies, $node);
$this->assertEqual($expected_page, $returned_page, format_string('Threaded mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
}
}
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 1204125..393dc4c 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -591,7 +591,7 @@ function template_preprocess_forums(&$variables) {
if ($topic->new_replies) {
$page_nr = \Drupal::entityManager()->getStorage('comment')
- ->getNewCommentPageNr($topic->comment_count, $topic->new_replies, $topic, 'comment_node_forum');
+ ->getNewCommentPageNumber($topic->comment_count, $topic->new_replies, $topic, 'comment_node_forum');
$query = $page_nr ? array('page' => $page_nr) : NULL;
$variables['topics'][$id]->new_text = format_plural($topic->new_replies, '1 new post in topic %title', '@count new posts in topic %title', array('%title' => $variables['topics'][$id]->label()));
$variables['topics'][$id]->new_url = url('node/' . $topic->id(), array('query' => $query, 'fragment' => 'new'));