You are here

public function FilterFormat::filters in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/filter/src/Entity/FilterFormat.php \Drupal\filter\Entity\FilterFormat::filters()

Returns the ordered collection of filter plugin instances or an individual plugin instance.

Parameters

string $instance_id: (optional) The ID of a filter plugin instance to return.

Return value

\Drupal\filter\FilterPluginCollection|\Drupal\filter\Plugin\FilterInterface Either the filter collection or a specific filter plugin instance.

Overrides FilterFormatInterface::filters

3 calls to FilterFormat::filters()
FilterFormat::getFilterTypes in core/modules/filter/src/Entity/FilterFormat.php
Retrieves all filter types that are used in the text format.
FilterFormat::getPluginCollections in core/modules/filter/src/Entity/FilterFormat.php
Gets the plugin collections used by this object.
FilterFormat::onDependencyRemoval in core/modules/filter/src/Entity/FilterFormat.php
Informs the entity that entities it depends on will be deleted.

File

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

Class

FilterFormat
Represents a text format.

Namespace

Drupal\filter\Entity

Code

public function filters($instance_id = NULL) {
  if (!isset($this->filterCollection)) {
    $this->filterCollection = new FilterPluginCollection(\Drupal::service('plugin.manager.filter'), $this->filters);
    $this->filterCollection
      ->sort();
  }
  if (isset($instance_id)) {
    return $this->filterCollection
      ->get($instance_id);
  }
  return $this->filterCollection;
}