diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 6736c60..4eeb5f8 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -235,7 +235,7 @@ function comment_permission() {
/**
* Calculates the page number for the first new comment.
*
- * @param int $total_comments_number
+ * @param int $total_comments
* The total number of comments that the entity has.
* @param int $new_comments
* The number of new comments that the entity has.
@@ -248,14 +248,14 @@ function comment_permission() {
* An array "page=X" if the page number is greater than zero; NULL otherwise.
*
* @deprecated Deprecated since Drupal 8.x-dev, to be removed in Drupal 8.0.
- * Use \Drupal\comment\CommentStorageInterface::getNewCommentPageNr();
+ * Use \Drupal\comment\CommentStorageInterface::getNewCommentPageNumber();
* Note this returns an integer instead of array|null.
*/
-function comment_new_page_count($total_comments_number, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
- $page_nr = \Drupal::entityManager()->getStorage('comment')
- ->getNewCommentPageNumber($total_comments_number, $new_comments, $entity, $field_name);
+function comment_new_page_count($total_comments, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
+ $page_number = \Drupal::entityManager()->getStorage('comment')
+ ->getNewCommentPageNumber($total_comments, $new_comments, $entity, $field_name);
- return $page_nr ? array('page' => $page_nr) : NULL;
+ return $page_number ? array('page' => $page_number) : NULL;
}
/**
diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php
index 7e54759..3e1aacb 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 getNewCommentPageNumber($total_comments_number, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
+ public function getNewCommentPageNumber($total_comments, $new_comments, ContentEntityInterface $entity, $field_name = 'comment') {
$instance = $entity->getFieldDefinition($field_name);
$comments_per_page = $instance->getSetting('per_page');
- if ($total_comments_number <= $comments_per_page) {
+ if ($total_comments <= $comments_per_page) {
// Only one page of comments.
$count = 0;
}
elseif ($instance->getSetting('default_mode') == CommentManagerInterface::COMMENT_MODE_FLAT) {
// Flat comments.
- $count = $total_comments_number - $new_comments;
+ $count = $total_comments - $new_comments;
}
else {
// Threaded comments.
diff --git a/core/modules/comment/src/CommentStorageInterface.php b/core/modules/comment/src/CommentStorageInterface.php
index 678eadb..f97663a 100644
--- a/core/modules/comment/src/CommentStorageInterface.php
+++ b/core/modules/comment/src/CommentStorageInterface.php
@@ -41,7 +41,7 @@ public function getMaxThreadPerThread(CommentInterface $comment);
/**
* Calculates the page number for the first new comment.
*
- * @param int $total_comments_number
+ * @param int $total_comments
* The total number of comments that the entity has.
* @param int $new_comments
* The number of new comments that the entity has.
@@ -53,7 +53,7 @@ public function getMaxThreadPerThread(CommentInterface $comment);
* @return array|null
* An array "page=X" if the page number is greater than zero; NULL otherwise.
*/
- public function getNewCommentPageNumber($total_comments_number, $new_comments, ContentEntityInterface $entity, $field_name = 'comment');
+ public function getNewCommentPageNumber($total_comments, $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 440d8c2..9d46dfb 100644
--- a/core/modules/comment/src/CommentViewBuilder.php
+++ b/core/modules/comment/src/CommentViewBuilder.php
@@ -336,10 +336,10 @@ public static function attachNewCommentsLinkMetadata(array $element, array $cont
->getStorage($context['entity_type'])
->load($context['entity_id']);
$field_name = $context['field_name'];
- $page_nr = \Drupal::entityManager()
+ $page_number = \Drupal::entityManager()
->getStorage('comment')
->getNewCommentPageNumber($entity->{$field_name}->comment_count, $new, $entity);
- $query = $page_nr ? array('page' => $page_nr) : NULL;
+ $query = $page_number ? array('page' => $page_number) : NULL;
// Attach metadata.
$element['#attached']['js'][] = array(
diff --git a/core/modules/comment/src/Controller/CommentController.php b/core/modules/comment/src/Controller/CommentController.php
index a87b948..e224fe2 100644
--- a/core/modules/comment/src/Controller/CommentController.php
+++ b/core/modules/comment/src/Controller/CommentController.php
@@ -290,9 +290,9 @@ public function renderNewCommentsNodeLinks(Request $request) {
foreach ($nids as $nid) {
$node = node_load($nid);
$new = comment_num_new($node->id(), 'node');
- $page_nr = $this->entityManager()->getStorage('comment')
+ $page_number = $this->entityManager()->getStorage('comment')
->getNewCommentPageNumber($node->{$field_name}->comment_count, $new, $node);
- $query = $page_nr ? array('page' => $page_nr) : NULL;
+ $query = $page_number ? array('page' => $page_number) : NULL;
$links[$nid] = array(
'new_comment_count' => (int) $new,
'first_new_comment_link' => $this->urlGenerator()->generateFromPath('node/' . $node->id(), array('query' => $query, 'fragment' => 'new')),
diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
index 93a8b88..495b175 100644
--- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php
@@ -151,11 +151,11 @@ protected function renderLink($data, ResultRow $values) {
'nid' => $this->getValue($values, 'nid'),
'type' => $this->getValue($values, 'type'),
));
- $page_nr = \Drupal::entityManager()->getStorage('comment')
+ $page_number = \Drupal::entityManager()->getStorage('comment')
->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;
+ $this->options['alter']['query'] = $page_number ? array('page' => $page_number) : NULL;
$this->options['alter']['fragment'] = 'new';
}
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 8714f70..3a86279 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -590,9 +590,9 @@ function template_preprocess_forums(&$variables) {
$variables['topics'][$id]->new_url = '';
if ($topic->new_replies) {
- $page_nr = \Drupal::entityManager()->getStorage('comment')
+ $page_number = \Drupal::entityManager()->getStorage('comment')
->getNewCommentPageNumber($topic->comment_count, $topic->new_replies, $topic, 'comment_node_forum');
- $query = $page_nr ? array('page' => $page_nr) : NULL;
+ $query = $page_number ? array('page' => $page_number) : 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'));
}