diff --git a/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php b/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php index 0d491891b2bfad4bb34921d1b2c18e813d2d6c00..a1edbd963e2d33e16ae4d977bf26c33a13c9bd5a 100644 --- a/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php +++ b/core/modules/filter/lib/Drupal/filter/FilterFormatAccessController.php @@ -22,9 +22,14 @@ class FilterFormatAccessController extends EntityAccessController { protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) { // Handle special cases up front. All users have access to the fallback // format. - if ($entity->isFallbackFormat()) { + if ($operation == 'view' && $entity->isFallbackFormat()) { return TRUE; } + // We do not allow filter formats to be deleted through the UI, because that + // would render any content that uses them unusable. + if ($operation == 'delete') { + return FALSE; + } if ($operation != 'view' && $account->hasPermission('administer filters')) { return TRUE; diff --git a/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php b/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php index 3e1debf93d7b6bc82292b4e85fa5c130c56fd0b7..70dab80ef10ad04d0b0f26976afa39a8a3402370 100644 --- a/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php +++ b/core/modules/filter/lib/Drupal/filter/FilterFormatListController.php @@ -135,8 +135,6 @@ public function getOperations(EntityInterface $entity) { unset($operations['disable']); } - // Formats can never be deleted. - unset($operations['delete']); return $operations; }