function CommentDefaultFormatter::calculateDependencies

Same name and namespace in other branches
  1. 8.9.x core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::calculateDependencies()
  2. 10 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::calculateDependencies()
  3. 11.x core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::calculateDependencies()

Overrides PluginSettingsBase::calculateDependencies

File

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

Class

CommentDefaultFormatter
Provides a default comment formatter.

Namespace

Drupal\comment\Plugin\Field\FieldFormatter

Code

public function calculateDependencies() {
    $dependencies = parent::calculateDependencies();
    if ($mode = $this->getSetting('view_mode')) {
        if ($bundle = $this->getFieldSetting('comment_type')) {
            
            /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
            if ($display = EntityViewDisplay::load("comment.{$bundle}.{$mode}")) {
                $dependencies[$display->getConfigDependencyKey()][] = $display->getConfigDependencyName();
            }
        }
    }
    return $dependencies;
}

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