diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 0508c7f..25fb274 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -99,8 +99,8 @@ function filter_system_info_alter(&$info, Extension $file, $type) { if (!empty($filter_plugins)) { $used_in = []; // Find out if any filter formats have the plugin enabled. - foreach(filter_formats() as $filter_format) { - foreach($filter_plugins as $filter_plugin) { + foreach (filter_formats() as $filter_format) { + foreach ($filter_plugins as $filter_plugin) { if ($filter_format->filters($filter_plugin['id'])->status) { $used_in[] = $filter_format->label(); $info['required'] = TRUE; diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php index 8ac55cd..0b7c6af 100644 --- a/core/modules/filter/src/Entity/FilterFormat.php +++ b/core/modules/filter/src/Entity/FilterFormat.php @@ -403,7 +403,8 @@ public function onDependencyRemoval(array $dependencies) { $changed = FALSE; $filters = $this->filters(); foreach ($filters as $filter) { - // Only remove disabled filters. + // 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; diff --git a/core/modules/filter/src/Tests/FilterAPITest.php b/core/modules/filter/src/Tests/FilterAPITest.php index 8b01fc1..2808fc1 100644 --- a/core/modules/filter/src/Tests/FilterAPITest.php +++ b/core/modules/filter/src/Tests/FilterAPITest.php @@ -389,11 +389,15 @@ public function assertFilterFormatViolation(ConstraintViolationListInterface $vi } /** - * Tests that dependency removal works. + * Tests that filter format dependency removal works. * - * Uninstalling a module that provides a filter plugin should not remove a - * filter format configuration entity that does not have the filter plugin - * enabled. + * Ensure that modules providing filter plugins are required when the plugin + * is in use, and that only disabled plugins are removed from format + * configuration entities rather than the configuration entities being + * deleted. + * + * @see \Drupal\filter\Entity\FilterFormat::onDependencyRemoval() + * @see filter_system_info_alter() */ public function testDependencyRemoval() { $this->installSchema('user', array('users_data'));