function ElementInfoManager::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/ElementInfoManager.php \Drupal\Core\Render\ElementInfoManager::__construct()
  2. 8.9.x core/lib/Drupal/Core/Render/ElementInfoManager.php \Drupal\Core\Render\ElementInfoManager::__construct()
  3. 11.x core/lib/Drupal/Core/Render/ElementInfoManager.php \Drupal\Core\Render\ElementInfoManager::__construct()

Constructs an ElementInfoManager object.

Parameters

\Traversable $namespaces: An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations.

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

\Drupal\Core\Extension\ThemeHandlerInterface|\Drupal\Core\Cache\CacheTagsInvalidatorInterface $theme_handler: The theme handler.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler to invoke the alter hook with.

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

Overrides DefaultPluginManager::__construct

File

core/lib/Drupal/Core/Render/ElementInfoManager.php, line 73

Class

ElementInfoManager
Provides a plugin manager for element plugins.

Namespace

Drupal\Core\Render

Code

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ThemeHandlerInterface|CacheTagsInvalidatorInterface $theme_handler, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager) {
    $this->setCacheBackend($cache_backend, 'element_info');
    $this->themeManager = $theme_manager;
    if ($theme_handler instanceof CacheTagsInvalidatorInterface) {
        @trigger_error('Calling ' . __METHOD__ . '() with the $cache_tag_invalidator argument is deprecated in drupal:10.2.0 and will be removed in drupal:11.0.0. Pass $theme_handler instead. See https://www.drupal.org/node/3355227', E_USER_DEPRECATED);
        $theme_handler = \Drupal::service('theme_handler');
    }
    $this->themeHandler = $theme_handler;
    parent::__construct('Element', $namespaces, $module_handler, 'Drupal\\Core\\Render\\Element\\ElementInterface', RenderElement::class, 'Drupal\\Core\\Render\\Annotation\\RenderElement');
    $this->alterInfo('element_plugin');
}

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