3 namespace Drupal\Core\Plugin;
5 use Drupal\Component\Plugin\PluginManagerInterface;
8 * Provides an interface for plugin managers that allow filtering definitions.
10 interface FilteredPluginManagerInterface extends PluginManagerInterface {
13 * Gets the plugin definitions for a given type and consumer and filters them.
15 * This allows modules and themes to alter plugin definitions at runtime,
16 * which is useful for tasks like hiding specific plugins from a particular
19 * @param string $consumer
20 * A string identifying the consumer of these plugin definitions.
21 * @param \Drupal\Component\Plugin\Context\ContextInterface[]|null $contexts
22 * (optional) Either an array of contexts to use for filtering, or NULL to
23 * not filter by contexts.
24 * @param mixed[] $extra
25 * (optional) An associative array containing additional information
26 * provided by the code requesting the filtered definitions.
28 * @return \Drupal\Component\Plugin\Definition\PluginDefinitionInterface[]|array[]
29 * An array of plugin definitions that are filtered.
31 * @see hook_plugin_filter_TYPE_alter()
32 * @see hook_plugin_filter_TYPE__CONSUMER_alter()
34 public function getFilteredDefinitions($consumer, $contexts = NULL, array $extra = []);