function DefaultPluginManager::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::__construct()
- 8.9.x core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::__construct()
- 11.x core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::__construct()
Constructs a new \Drupal\Core\Plugin\DefaultPluginManager object.
@todo $plugin_definition_attribute_name should default to 'Drupal\Component\Plugin\Attribute\Plugin' once annotations are no longer supported.
Parameters
string|bool $subdir: The plugin's subdirectory, for example Plugin/views/filter.
\Traversable $namespaces: An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations.
\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.
string|null $plugin_interface: (optional) The interface each plugin should implement.
string|null $plugin_definition_attribute_name: (optional) The name of the attribute that contains the plugin definition.
string|array|null $plugin_definition_annotation_name: (optional) The name of the annotation that contains the plugin definition. Defaults to 'Drupal\Component\Annotation\Plugin'.
string[] $additional_annotation_namespaces: (optional) Additional namespaces to scan for annotation definitions.
51 methods override DefaultPluginManager::__construct()
- ActionManager::__construct in core/
lib/ Drupal/ Core/ Action/ ActionManager.php - Constructs a new class instance.
- ArchiverManager::__construct in core/
lib/ Drupal/ Core/ Archiver/ ArchiverManager.php - Constructs an ArchiverManager object.
- BlockManager::__construct in core/
lib/ Drupal/ Core/ Block/ BlockManager.php - Constructs a new \Drupal\Core\Block\BlockManager object.
- BreakpointManager::__construct in core/
modules/ breakpoint/ src/ BreakpointManager.php - Constructs a new BreakpointManager instance.
- CategorizingPluginManager::__construct in core/
tests/ Drupal/ Tests/ Core/ Plugin/ CategorizingPluginManagerTraitTest.php - Replace the constructor so we can instantiate a stub.
File
-
core/
lib/ Drupal/ Core/ Plugin/ DefaultPluginManager.php, line 154
Class
- DefaultPluginManager
- Base class for plugin managers.
Namespace
Drupal\Core\PluginCode
public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_interface = NULL, ?string $plugin_definition_attribute_name = NULL, string|array|null $plugin_definition_annotation_name = NULL, array $additional_annotation_namespaces = []) {
$this->subdir = $subdir;
$this->namespaces = $namespaces;
$this->moduleHandler = $module_handler;
$this->pluginInterface = $plugin_interface;
if (is_subclass_of($plugin_definition_attribute_name, AttributeInterface::class)) {
$this->pluginDefinitionAttributeName = $plugin_definition_attribute_name;
$this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name;
$this->additionalAnnotationNamespaces = $additional_annotation_namespaces;
}
else {
// Backward compatibility.
$this->pluginDefinitionAnnotationName = $plugin_definition_attribute_name ?? 'Drupal\\Component\\Annotation\\Plugin';
$this->additionalAnnotationNamespaces = $plugin_definition_annotation_name ?? [];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.