function FilterFormat::preSave

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

Overrides ConfigEntityBase::preSave

File

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

Class

FilterFormat
Represents a text format.

Namespace

Drupal\filter\Entity

Code

public function preSave(EntityStorageInterface $storage) {
    // Ensure the filters have been sorted before saving.
    $this->filters()
        ->sort();
    parent::preSave($storage);
    assert(is_string($this->label()), 'Filter format label is expected to be a string.');
    $this->name = trim($this->label());
}

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