3 namespace Drupal\filter;
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
8 * Provides an interface defining a filter format entity.
10 interface FilterFormatInterface extends ConfigEntityInterface {
13 * Returns the ordered collection of filter plugin instances or an individual plugin instance.
15 * @param string $instance_id
16 * (optional) The ID of a filter plugin instance to return.
18 * @return \Drupal\filter\FilterPluginCollection|\Drupal\filter\Plugin\FilterInterface
19 * Either the filter collection or a specific filter plugin instance.
21 public function filters($instance_id = NULL);
24 * Sets the configuration for a filter plugin instance.
26 * Sets or replaces the configuration of a filter plugin in $this->filters,
27 * and if instantiated already, also ensures that the actual filter plugin on
28 * the FilterPluginCollection contains the identical configuration.
30 * @param string $instance_id
31 * The ID of a filter plugin to set the configuration for.
32 * @param array $configuration
33 * The filter plugin configuration to set.
35 public function setFilterConfig($instance_id, array $configuration);
38 * Returns if this format is the fallback format.
40 * The fallback format can never be disabled. It must always be available.
43 * TRUE if this format is the fallback format, FALSE otherwise.
45 public function isFallbackFormat();
48 * Returns the machine-readable permission name for the text format.
51 * The machine-readable permission name, or FALSE if the text format is
52 * malformed or is the fallback format (which is available to all users).
54 public function getPermissionName();
57 * Retrieves all filter types that are used in the text format.
60 * All filter types used by filters of the text format.
62 public function getFilterTypes();
65 * Retrieve all HTML restrictions (tags and attributes) for the text format.
67 * Note that restrictions applied to the "*" tag (the wildcard tag, i.e. all
68 * tags) are treated just like any other HTML tag. That means that any
69 * restrictions applied to it are not automatically applied to all other tags.
70 * It is up to the caller to handle this in whatever way it sees fit; this way
71 * no information granularity is lost.
74 * A structured array as returned by FilterInterface::getHTMLRestrictions(),
75 * but with the intersection of all filters in this text format.
76 * Will either indicate blacklisting of tags or whitelisting of tags. In
77 * the latter case, it's possible that restrictions on attributes are also
78 * stored. FALSE means there are no HTML restrictions.
80 public function getHtmlRestrictions();
85 * @param string $instance_id
86 * The ID of a filter plugin to be removed.
88 public function removeFilter($instance_id);