You are here

public function StylePluginManager::__construct in Styles API 8

Constructs a LayoutPluginManager 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\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/Style/StylePluginManager.php, line 42
Contains \Drupal\styles_api\Plugin\Style\StylePluginManager.

Class

StylePluginManager
Plugin type manager for all styles.

Namespace

Drupal\styles_api\Plugin\Style

Code

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) {
  $plugin_interface = 'Drupal\\styles_api\\Plugin\\Style\\StyleInterface';
  $plugin_definition_annotation_name = 'Drupal\\styles_api\\Annotation\\Style';
  parent::__construct("Plugin/Style", $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name);
  $discovery = $this
    ->getDiscovery();
  $this->discovery = new YamlDiscoveryDecorator($discovery, 'themes', $module_handler
    ->getModuleDirectories() + $theme_handler
    ->getThemeDirectories());
  $this->themeHandler = $theme_handler;
  $this
    ->setCacheBackend($cache_backend, 'styles');
  $this
    ->alterInfo('styles');
}