You are here

public function BlockStyleManager::__construct in Block Style Plugins 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/BlockStyleManager.php \Drupal\block_style_plugins\Plugin\BlockStyleManager::__construct()

Constructor for BlockStyleManager objects.

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\ModuleHandlerInterface $module_handler: The module handler to invoke the alter hook with.

\Drupal\Core\Extension\ThemeHandlerInterface $theme_handler: The theme handler to get installation status.

\Drupal\Core\Theme\ThemeManagerInterface $theme_manager: The theme manager to invoke the alter hook with.

Overrides DefaultPluginManager::__construct

File

src/Plugin/BlockStyleManager.php, line 55

Class

BlockStyleManager
Provides the Block style plugin manager.

Namespace

Drupal\block_style_plugins\Plugin

Code

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, ThemeManagerInterface $theme_manager) {
  parent::__construct('Plugin/BlockStyle', $namespaces, $module_handler, 'Drupal\\block_style_plugins\\Plugin\\BlockStyleInterface', 'Drupal\\block_style_plugins\\Annotation\\BlockStyle');

  // Add in the Theme directory Discovery via Yaml file.
  $discovery = $this
    ->getDiscovery();
  $this->discovery = new YamlDiscoveryDecorator($discovery, 'blockstyle', $module_handler
    ->getModuleDirectories() + $theme_handler
    ->getThemeDirectories());
  $this->themeHandler = $theme_handler;
  $this->themeManager = $theme_manager;
  $this
    ->alterInfo('block_style_plugins_info');
  $this
    ->setCacheBackend($cache_backend, 'block_style_plugins');
}