You are here

public function BlockStyleManager::__construct in Block Style Plugins 8

Same name and namespace in other branches
  1. 8.2 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 handle to invoke the alter hook with.

Overrides DefaultPluginManager::__construct

File

src/Plugin/BlockStyleManager.php, line 45

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) {
  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
    ->alterInfo('block_style_plugins_info');
  $this
    ->setCacheBackend($cache_backend, 'block_style_plugins');
}