0404a66f8ee1da788e94f5ffaec4bdd94935d2f1
[yaffs-website] / web / core / lib / Drupal / Core / Plugin / FilteredPluginManagerInterface.php
1 <?php
2
3 namespace Drupal\Core\Plugin;
4
5 use Drupal\Component\Plugin\PluginManagerInterface;
6
7 /**
8  * Provides an interface for plugin managers that allow filtering definitions.
9  */
10 interface FilteredPluginManagerInterface extends PluginManagerInterface {
11
12   /**
13    * Gets the plugin definitions for a given type and consumer and filters them.
14    *
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
17    * user interface.
18    *
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.
27    *
28    * @return \Drupal\Component\Plugin\Definition\PluginDefinitionInterface[]|array[]
29    *   An array of plugin definitions that are filtered.
30    *
31    * @see hook_plugin_filter_TYPE_alter()
32    * @see hook_plugin_filter_TYPE__CONSUMER_alter()
33    */
34   public function getFilteredDefinitions($consumer, $contexts = NULL, array $extra = []);
35
36 }