diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php index f5e5c65..db136c9 100644 --- a/core/modules/filter/src/Entity/FilterFormat.php +++ b/core/modules/filter/src/Entity/FilterFormat.php @@ -150,13 +150,6 @@ public function filters($instance_id = NULL) { /** * {@inheritdoc} */ - public function status() { - return parent::status() || $this->isFallbackFormat(); - } - - /** - * {@inheritdoc} - */ public function getPluginCollections() { return array('filters' => $this->filters()); } @@ -187,6 +180,11 @@ public function toArray() { * {@inheritdoc} */ public function disable() { + // The fallback text format cannot be disabled. + if ($this->isFallbackFormat()) { + throw new \LogicException(sprintf("The fallback text format '%s' cannot be disabled.", $this->id())); + } + parent::disable(); // Allow modules to react on text format deletion. diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php index e46fcb4..d449fb0 100644 --- a/core/modules/filter/src/Tests/FilterAdminTest.php +++ b/core/modules/filter/src/Tests/FilterAdminTest.php @@ -9,7 +9,6 @@ use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Unicode; -use Drupal\Core\Database\Database; use Drupal\filter\Entity\FilterFormat; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; @@ -103,6 +102,7 @@ protected function setUp() { $basic_html_format->getPermissionName(), $restricted_html_format->getPermissionName(), $full_html_format->getPermissionName(), + 'access site reports', )); $this->webUser = $this->drupalCreateUser(array('create page content', 'edit own page content')); @@ -433,21 +433,17 @@ public function testDisabledFormat() { $this->drupalGet('node/' . $node->id()); - $message = Database::getConnection('default', 'default') - ->select('watchdog') - ->fields('watchdog', ['message']) - ->condition('type', 'filter') - ->condition('variables', serialize(['%format' => $format_id])) - ->execute() - ->fetchField(); - - // The correct message has been logged. - $this->assertIdentical($message, 'Disabled text format: %format.'); // The format is not used anymore. $this->assertNoText('filtered text'); // The text is not displayed unfiltered or escaped. $this->assertNoRaw($body_value); $this->assertNoEscaped($body_value); + + // Visit the dblog report page. + $this->drupalLogin($this->adminUser); + $this->drupalGet('admin/reports/dblog'); + // The correct message has been logged. + $this->assertRaw(sprintf('Disabled text format: %s.', $format_id)); } }