function FilterFormat::disable

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

Attributes

#[ActionMethod(adminLabel: new TranslatableMarkup('Disable'), pluralize: FALSE)]

Overrides ConfigEntityBase::disable

File

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

Class

FilterFormat
Represents a text format.

Namespace

Drupal\filter\Entity

Code

public function disable() {
  if ($this->isFallbackFormat()) {
    throw new \LogicException("The fallback text format '{$this->id()}' cannot be disabled.");
  }
  parent::disable();
  // Allow modules to react on text format deletion.
  \Drupal::moduleHandler()->invokeAll('filter_format_disable', [
    $this,
  ]);
  // Clear the filter cache whenever a text format is disabled.
  filter_formats_reset();
  return $this;
}

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