function ComponentPluginManager::__construct

Same name in this branch
  1. 11.x core/modules/sdc/src/ComponentPluginManager.php \Drupal\sdc\ComponentPluginManager::__construct()
Same name in other branches
  1. 10 core/modules/sdc/src/ComponentPluginManager.php \Drupal\sdc\ComponentPluginManager::__construct()
  2. 10 core/lib/Drupal/Core/Theme/ComponentPluginManager.php \Drupal\Core\Theme\ComponentPluginManager::__construct()

Constructs ComponentPluginManager object.

Parameters

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

\Drupal\Core\Extension\ThemeHandlerInterface $themeHandler: The theme handler.

\Drupal\Core\Cache\CacheBackendInterface $cacheBackend: Cache backend instance to use.

\Drupal\Core\Config\ConfigFactoryInterface $configFactory: The configuration factory.

\Drupal\Core\Theme\ThemeManagerInterface $themeManager: The theme manager.

\Drupal\Core\Theme\ComponentNegotiator $componentNegotiator: The component negotiator.

\Drupal\Core\File\FileSystemInterface $fileSystem: The file system service.

\Drupal\Core\Theme\Component\SchemaCompatibilityChecker $compatibilityChecker: The compatibility checker.

\Drupal\Core\Theme\Component\ComponentValidator $componentValidator: The component validator.

string $appRoot: The application root.

Overrides DefaultPluginManager::__construct

File

core/lib/Drupal/Core/Theme/ComponentPluginManager.php, line 64

Class

ComponentPluginManager
Defines a plugin manager to deal with components.

Namespace

Drupal\Core\Theme

Code

public function __construct(ModuleHandlerInterface $module_handler, ThemeHandlerInterface $themeHandler, CacheBackendInterface $cacheBackend, ConfigFactoryInterface $configFactory, ThemeManagerInterface $themeManager, ComponentNegotiator $componentNegotiator, FileSystemInterface $fileSystem, SchemaCompatibilityChecker $compatibilityChecker, ComponentValidator $componentValidator, string $appRoot) {
    // We are skipping the call to the parent constructor to avoid initializing
    // variables aimed for annotation discovery, that are unnecessary here.
    // Plugin managers using YAML discovery also skip the parent constructor,
    // like LinkRelationTypeManager.
    $this->moduleHandler = $module_handler;
    $this->factory = new ContainerFactory($this);
    $this->setCacheBackend($cacheBackend, 'component_plugins');
    // Note that we are intentionally skipping $this->alterInfo('component_info');
    // We want to ensure that everything related to a component is in the
    // single directory. If the alteration of a component is necessary,
    // component replacement is the preferred tool for that.
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.