diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php index ad5149f..cdd68f6 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php @@ -239,7 +239,10 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - $summary = [$this->t('Comment view mode: @mode', ['@mode' => $this->getViewModes()[$this->getSetting('view_mode')]])]; + $view_mode = $this->getSetting('view_mode'); + $view_modes = $this->getViewModes(); + $view_mode_label = isset($view_modes[$view_mode]) ? $view_modes[$view_mode] : 'default'; + $summary = [$this->t('Comment view mode: @mode', ['@mode' => $view_mode_label])]; if ($pager_id = $this->getSetting('pager_id')) { $summary[] = $this->t('Pager ID: @id', ['@id' => $pager_id]); } diff --git a/core/modules/comment/src/Tests/CommentPagerTest.php b/core/modules/comment/src/Tests/CommentPagerTest.php index 9061f64..14cd3b5 100644 --- a/core/modules/comment/src/Tests/CommentPagerTest.php +++ b/core/modules/comment/src/Tests/CommentPagerTest.php @@ -288,6 +288,7 @@ function testTwoPagers() { 'weight' => 30, 'settings' => array( 'pager_id' => 1, + 'view_mode' => 'default', ) )) ->save();