function ResponsiveImageFormatter::calculateDependencies

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

Overrides PluginSettingsBase::calculateDependencies

File

core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php, line 259

Class

ResponsiveImageFormatter
Plugin for responsive image formatter.

Namespace

Drupal\responsive_image\Plugin\Field\FieldFormatter

Code

public function calculateDependencies() {
    $dependencies = parent::calculateDependencies();
    $style_id = $this->getSetting('responsive_image_style');
    
    /** @var \Drupal\responsive_image\ResponsiveImageStyleInterface $style */
    if ($style_id && ($style = ResponsiveImageStyle::load($style_id))) {
        // Add the responsive image style as dependency.
        $dependencies[$style->getConfigDependencyKey()][] = $style->getConfigDependencyName();
    }
    return $dependencies;
}

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