You are here

protected function CommentDefaultFormatter::getViewModes in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::getViewModes()
  2. 10 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::getViewModes()

Provides a list of comment view modes for the configured comment type.

Return value

array Associative array keyed by view mode key and having the view mode label as value.

2 calls to CommentDefaultFormatter::getViewModes()
CommentDefaultFormatter::settingsForm in core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
Returns a form to configure settings for the formatter.
CommentDefaultFormatter::settingsSummary in core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
Returns a short summary for the current formatter settings.

File

core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php, line 297

Class

CommentDefaultFormatter
Provides a default comment formatter.

Namespace

Drupal\comment\Plugin\Field\FieldFormatter

Code

protected function getViewModes() {
  return $this->entityDisplayRepository
    ->getViewModeOptionsByBundle('comment', $this
    ->getFieldSetting('comment_type'));
}