File
-
src/Plugin/Field/FieldFormatter/ColorboxFormatter.php, line 468
Class
- ColorboxFormatter
- Plugin implementation of the 'colorbox' formatter.
Namespace
Drupal\colorbox\Plugin\Field\FieldFormatter
Code
public function onDependencyRemoval(array $dependencies) {
$changed = parent::onDependencyRemoval($dependencies);
$style_ids = [];
$style_ids['colorbox_node_style'] = $this->getSetting('colorbox_node_style');
if (!empty($this->getSetting('colorbox_node_style_first'))) {
$style_ids['colorbox_node_style_first'] = $this->getSetting('colorbox_node_style_first');
}
$style_ids['colorbox_image_style'] = $this->getSetting('colorbox_image_style');
foreach ($style_ids as $name => $style_id) {
if ($style_id && ($style = ImageStyle::load($style_id))) {
if (!empty($dependencies[$style->getConfigDependencyKey()][$style->getConfigDependencyName()])) {
$replacement_id = $this->imageStyleStorage
->getReplacementId($style_id);
if ($replacement_id && ImageStyle::load($replacement_id)) {
$this->setSetting($name, $replacement_id);
$changed = TRUE;
}
}
}
}
return $changed;
}