You are here

public function LayoutPluginManager::__construct in Layout Plugin (obsolete, use core's Layout Discovery) 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/Layout/LayoutPluginManager.php, line 39

Class

LayoutPluginManager
Plugin type manager for all layouts.

Namespace

Drupal\layout_plugin\Plugin\Layout

Code

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) {
  $plugin_interface = 'Drupal\\layout_plugin\\Plugin\\Layout\\LayoutInterface';
  $plugin_definition_annotation_name = 'Drupal\\layout_plugin\\Annotation\\Layout';
  parent::__construct("Plugin/Layout", $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name);
  $discovery = $this
    ->getDiscovery();
  $this->discovery = new YamlDiscoveryDecorator($discovery, 'layouts', $module_handler
    ->getModuleDirectories() + $theme_handler
    ->getThemeDirectories());
  $this->themeHandler = $theme_handler;
  $this->defaults += array(
    'type' => 'page',
    // Used for plugins defined in layouts.yml that do not specify a class
    // themselves.
    'class' => 'Drupal\\layout_plugin\\Plugin\\Layout\\LayoutDefault',
  );
  $this
    ->setCacheBackend($cache_backend, 'layout');
  $this
    ->alterInfo('layout');
}