function FilteredPluginManagerTrait::getFilteredDefinitions
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Plugin/FilteredPluginManagerTrait.php \Drupal\Core\Plugin\FilteredPluginManagerTrait::getFilteredDefinitions()
- 10 core/lib/Drupal/Core/Plugin/FilteredPluginManagerTrait.php \Drupal\Core\Plugin\FilteredPluginManagerTrait::getFilteredDefinitions()
- 11.x core/lib/Drupal/Core/Plugin/FilteredPluginManagerTrait.php \Drupal\Core\Plugin\FilteredPluginManagerTrait::getFilteredDefinitions()
Implements \Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions().
File
-
core/
lib/ Drupal/ Core/ Plugin/ FilteredPluginManagerTrait.php, line 19
Class
- FilteredPluginManagerTrait
- Provides a trait for plugin managers that allow filtering plugin definitions.
Namespace
Drupal\Core\PluginCode
public function getFilteredDefinitions($consumer, $contexts = NULL, array $extra = []) {
if (!is_null($contexts)) {
$definitions = $this->getDefinitionsForContexts($contexts);
}
else {
$definitions = $this->getDefinitions();
}
$type = $this->getType();
$hooks = [];
$hooks[] = "plugin_filter_{$type}";
$hooks[] = "plugin_filter_{$type}__{$consumer}";
$this->moduleHandler()
->alter($hooks, $definitions, $extra, $consumer);
$this->themeManager()
->alter($hooks, $definitions, $extra, $consumer);
return $definitions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.