diff -u b/core/modules/comment/comment.module b/core/modules/comment/comment.module --- b/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -190,7 +190,6 @@ // can do so by implementing a new field formatter. // @todo Make this configurable from the formatter. See // https://www.drupal.org/node/1901110. - $comment_links = \Drupal::service('comment.link_builder')->buildCommentedEntityLinks($node, $context); $links += $comment_links; } @@ -220,6 +219,7 @@ // can do so by implementing a new field formatter. // @todo Make this configurable from the formatter. See // https://www.drupal.org/node/1901110. + $comment_links = \Drupal::service('comment.link_builder')->buildCommentedEntityLinks($node, $context); $links += $comment_links; } diff -u b/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php --- b/core/modules/comment/src/CommentForm.php +++ b/core/modules/comment/src/CommentForm.php @@ -79,7 +79,7 @@ parent::__construct($entity_repository, $entity_type_bundle_info, $time); $this->currentUser = $current_user; $this->renderer = $renderer; - $this->entityFieldManager = $entity_field_manager ?: \Drupal::service('entity_field.manager'); + $this->entityFieldManager = $entity_field_manager; } /** diff -u b/core/modules/comment/src/CommentStatistics.php b/core/modules/comment/src/CommentStatistics.php --- b/core/modules/comment/src/CommentStatistics.php +++ b/core/modules/comment/src/CommentStatistics.php @@ -163,7 +163,7 @@ public function getRankingInfo() { return [ 'comments' => [ - 'title' => t('Number of comments'), + 'title' => $this->t('Number of comments'), 'join' => [ 'type' => 'LEFT', 'table' => 'comment_entity_statistics', only in patch2: unchanged: --- a/core/modules/comment/src/CommentLazyBuilders.php +++ b/core/modules/comment/src/CommentLazyBuilders.php @@ -170,20 +170,20 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment if ($status == CommentItemInterface::OPEN) { if ($entity->access('delete')) { $links['comment-delete'] = [ - 'title' => t('Delete'), + 'title' => $this->t('Delete'), 'url' => $entity->toUrl('delete-form'), ]; } if ($entity->access('update')) { $links['comment-edit'] = [ - 'title' => t('Edit'), + 'title' => $this->t('Edit'), 'url' => $entity->toUrl('edit-form'), ]; } if ($entity->access('create')) { $links['comment-reply'] = [ - 'title' => t('Reply'), + 'title' => $this->t('Reply'), 'url' => Url::fromRoute('comment.reply', [ 'entity_type' => $entity->getCommentedEntityTypeId(), 'entity' => $entity->getCommentedEntityId(), @@ -194,7 +194,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment } if (!$entity->isPublished() && $entity->access('approve')) { $links['comment-approve'] = [ - 'title' => t('Approve'), + 'title' => $this->t('Approve'), 'url' => Url::fromRoute('comment.approve', ['comment' => $entity->id()]), ]; } @@ -206,7 +206,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment // Add translations link for translation-enabled comment bundles. if ($this->moduleHandler->moduleExists('content_translation') && $this->access($entity)->isAllowed()) { $links['comment-translations'] = [ - 'title' => t('Translate'), + 'title' => $this->t('Translate'), 'url' => $entity->toUrl('drupal:content-translation-overview'), ]; } only in patch2: unchanged: --- a/core/modules/comment/src/CommentStorage.php +++ b/core/modules/comment/src/CommentStorage.php @@ -147,7 +147,6 @@ public function getNewCommentPageNumber($total_comments, $new_comments, Fieldabl $field = $entity->getFieldDefinition($field_name); $comments_per_page = $field->getSetting('per_page'); $data_table = $this->getDataTable(); - if ($total_comments <= $comments_per_page) { // Only one page of comments. $count = 0; only in patch2: unchanged: --- a/core/modules/comment/src/CommentViewsData.php +++ b/core/modules/comment/src/CommentViewsData.php @@ -200,7 +200,8 @@ public function getViewsData() { if ($type == 'comment' || !$entity_type->entityClassImplements(ContentEntityInterface::class) || !$entity_type->getBaseTable()) { continue; } - if ($fields = \Drupal::service('comment.manager')->getFields($type)) { + $fields = \Drupal::service('comment.manager')->getFields($type); + if ($fields) { $data['comment_field_data'][$type] = [ 'relationship' => [ 'title' => $entity_type->getLabel(), only in patch2: unchanged: --- a/core/modules/comment/src/Entity/Comment.php +++ b/core/modules/comment/src/Entity/Comment.php @@ -111,7 +111,6 @@ public function preSave(EntityStorageInterface $storage) { else { // This is a comment with a parent comment, so increase the part of // the thread value at the proper depth. - // Get the parent comment: $parent = $this->getParentComment(); // Strip the "/" from the end of the parent thread. @@ -193,7 +192,7 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti $comments = $comment_storage->loadMultiple($child_cids); $comment_storage->delete($comments); - foreach ($entities as $id => $entity) { + foreach ($entities as $entity) { \Drupal::service('comment.statistics')->update($entity); } }