trait FilteredPluginManagerTrait (View source)

Provides a trait for plugin managers that allow filtering plugin definitions.

Traits

Provides a trait for plugin managers that support context-aware plugins.

Methods

getDefinitionsForContexts(array $contexts = [])

See \Drupal\Core\Plugin\Context\ContextAwarePluginManagerInterface::getDefinitionsForContexts().

getDefinitions()

See \Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().

getFilteredDefinitions($consumer, $contexts = NULL, array $extra = [])

Implements \Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions().

string
getType()

A string identifying the plugin type.

moduleHandler()

Wraps the module handler.

themeManager()

Wraps the theme manager.

Details

protected ContextHandlerInterface contextHandler()

Wraps the context handler.

getDefinitionsForContexts(array $contexts = [])

See \Drupal\Core\Plugin\Context\ContextAwarePluginManagerInterface::getDefinitionsForContexts().

Parameters

array $contexts

abstract getDefinitions()

See \Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().

getFilteredDefinitions($consumer, $contexts = NULL, array $extra = [])

Implements \Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions().

Parameters

$consumer
$contexts
array $extra

abstract protected string getType()

A string identifying the plugin type.

This string should be unique and generally will correspond to the string used by the discovery, e.g. the annotation class or the YAML file name.

Return Value

string

A string identifying the plugin type.

protected ModuleHandlerInterface moduleHandler()

Wraps the module handler.

Return Value

ModuleHandlerInterface

The module handler.

protected ThemeManagerInterface themeManager()

Wraps the theme manager.

Return Value

ThemeManagerInterface

The theme manager.