function FileVideoFormatter::onDependencyRemoval
Same name and namespace in other branches
- main core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\FileVideoFormatter::onDependencyRemoval()
Overrides PluginSettingsBase::onDependencyRemoval
File
-
core/
modules/ file/ src/ Plugin/ Field/ FieldFormatter/ FileVideoFormatter.php, line 271
Class
- FileVideoFormatter
- Plugin implementation of the 'file_video' formatter.
Namespace
Drupal\file\Plugin\Field\FieldFormatterCode
public function onDependencyRemoval(array $dependencies) : bool {
$changed = parent::onDependencyRemoval($dependencies);
$style_id = $this->getSetting('poster_image_style');
/** @var \Drupal\image\ImageStyleInterface $style */
if ($style_id && $style = ImageStyle::load($style_id)) {
if (!empty($dependencies[$style->getConfigDependencyKey()][$style->getConfigDependencyName()])) {
$replacement_id = $this->imageStyleStorage
->getReplacementId($style_id);
// If a valid replacement has been provided in the storage, replace the
// image style with the replacement and signal that the formatter plugin
// settings were updated.
if (!empty($replacement_id) && ImageStyle::load($replacement_id)) {
$this->setSetting('poster_image_style', $replacement_id);
$changed = TRUE;
}
}
}
return $changed;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.