Same name in other branches
- 2.0.x src/Plugin/Field/FieldFormatter/ColorboxFormatter.php \Drupal\colorbox\Plugin\Field\FieldFormatter\ColorboxFormatter::calculateDependencies()
Fichier
-
src/
Plugin/ Field/ FieldFormatter/ ColorboxFormatter.php, line 446
Classe
- ColorboxFormatter
- Plugin implementation of the 'colorbox' formatter.
Namespace
Drupal\colorbox\Plugin\Field\FieldFormatterCode
public function calculateDependencies() {
$dependencies = parent::calculateDependencies();
$style_ids = [];
$style_ids[] = $this->getSetting('colorbox_node_style');
if (!empty($this->getSetting('colorbox_node_style_first'))) {
$style_ids[] = $this->getSetting('colorbox_node_style_first');
}
$style_ids[] = $this->getSetting('colorbox_image_style');
/** @var \Drupal\image\ImageStyleInterface $style */
foreach ($style_ids as $style_id) {
if ($style_id && ($style = ImageStyle::load($style_id))) {
// If this formatter uses a valid image style to display the image, add
// the image style configuration entity as dependency of this formatter.
$dependencies[$style->getConfigDependencyKey()][] = $style->getConfigDependencyName();
}
}
return $dependencies;
}