function FilterFormat::onDependencyRemoval

Same name in other branches
  1. 9 core/modules/filter/src/Entity/FilterFormat.php \Drupal\filter\Entity\FilterFormat::onDependencyRemoval()
  2. 8.9.x core/modules/filter/src/Entity/FilterFormat.php \Drupal\filter\Entity\FilterFormat::onDependencyRemoval()
  3. 11.x core/modules/filter/src/Entity/FilterFormat.php \Drupal\filter\Entity\FilterFormat::onDependencyRemoval()

Overrides ConfigEntityBase::onDependencyRemoval

File

core/modules/filter/src/Entity/FilterFormat.php, line 403

Class

FilterFormat
Represents a text format.

Namespace

Drupal\filter\Entity

Code

public function onDependencyRemoval(array $dependencies) {
    $changed = parent::onDependencyRemoval($dependencies);
    $filters = $this->filters();
    foreach ($filters as $filter) {
        // Remove disabled filters, so that this FilterFormat config entity can
        // continue to exist.
        if (!$filter->status && in_array($filter->provider, $dependencies['module'])) {
            $this->removeFilter($filter->getPluginId());
            $changed = TRUE;
        }
    }
    return $changed;
}

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