diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 3fe147e..a4bbc9f 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -129,7 +129,7 @@ function comment_update_8001() { */ /** - * Adds the new 'view_mode' setting to all view displays having showing the + * Adds the new 'view_mode' setting to all view displays using the * 'comment_default' formatter. */ function comment_update_8101() { diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index d07c256..1b2340b 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -787,8 +787,7 @@ function comment_entity_view_display_presave(EntityViewDisplayInterface $display '@display' => $mode->label(), '@mode' => $display->getMode(), ]; - \Drupal::logger('system') - ->warning("View display '@id': Comment field formatter '@name' was disabled because is using the comment view display '@display' (@mode) that was just disabled.", $arguments); + \Drupal::logger('system')->warning("View display '@id': Comment field formatter '@name' was disabled because is using the comment view display '@display' (@mode) that was just disabled.", $arguments); $changed = TRUE; } } diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php index 80f6d1f..ad5149f 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php @@ -164,12 +164,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) { $comments_per_page = $comment_settings['per_page']; $comments = $this->storage->loadThread($entity, $field_name, $mode, $comments_per_page, $this->getSetting('pager_id')); if ($comments) { - if (($view_mode = $this->getSetting('view_mode')) === 'default') { - $build = $this->viewBuilder->viewMultiple($comments); - } - else { - $build = $this->viewBuilder->viewMultiple($comments, $view_mode); - } + $build = $this->viewBuilder->viewMultiple($comments, $this->getSetting('view_mode')); $build['pager']['#type'] = 'pager'; if ($this->getSetting('pager_id')) { $build['pager']['#element'] = $this->getSetting('pager_id'); @@ -244,10 +239,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - $summary = []; - if (($mode = $this->getSetting('view_mode')) !== 'default') { - $summary[] = $this->t('Comment view mode: @mode', ['@mode' => $this->getViewModes()[$mode]]); - } + $summary = [$this->t('Comment view mode: @mode', ['@mode' => $this->getViewModes()[$this->getSetting('view_mode')]])]; if ($pager_id = $this->getSetting('pager_id')) { $summary[] = $this->t('Pager ID: @id', ['@id' => $pager_id]); } @@ -278,8 +270,7 @@ public function calculateDependencies() { * as value. */ protected function getViewModes() { - return $this->entityManager - ->getViewModeOptionsByBundle('comment', $this->getFieldSetting('comment_type')); + return $this->entityManager->getViewModeOptionsByBundle('comment', $this->getFieldSetting('comment_type')); } } diff --git a/core/modules/comment/src/Tests/Update/CommentUpdateTest.php b/core/modules/comment/src/Tests/Update/CommentUpdateTest.php index 83ef05d..db1cb43 100644 --- a/core/modules/comment/src/Tests/Update/CommentUpdateTest.php +++ b/core/modules/comment/src/Tests/Update/CommentUpdateTest.php @@ -39,7 +39,7 @@ public function testCommentUpdate8101() { // Run updates. $this->runUpdates(); - // Reload the config, and check that 'view_mode' and has 'default' as value. + // Reload the config, and check that 'view_mode' has the value 'default'. $config = $this->config('core.entity_view_display.node.article.default'); $this->assertIdentical($config->get('content.comment.settings.view_mode'), 'default'); }