function CommentDefaultFormatter::getViewModes

Same name 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()
  3. 11.x 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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.