You are here

public function BlockManager::__construct in Multiversion 8

Same name and namespace in other branches
  1. 8.2 src/Block/BlockManager.php \Drupal\multiversion\Block\BlockManager::__construct()

Constructs a new \Drupal\multiversion\Block\BlockManager 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.

\Psr\Log\LoggerInterface $logger:

\Drupal\Core\Database\Connection $database: The database connection.

\Drupal\multiversion\Workspace\WorkspaceManagerInterface $workspace_manager: The workspace manager service.

Overrides BlockManager::__construct

File

src/Block/BlockManager.php, line 55

Class

BlockManager
Adds the workspace ID to the cache key.

Namespace

Drupal\multiversion\Block

Code

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LoggerInterface $logger, Connection $database, WorkspaceManagerInterface $workspace_manager) {
  parent::__construct($namespaces, $cache_backend, $module_handler, $logger);

  // @todo Remove this when Multiversion requires Drupal 8.6 or newer.
  if (floatval(\Drupal::VERSION) < 8.6) {
    parent::__construct($namespaces, $cache_backend, $module_handler);
  }
  else {
    parent::__construct($namespaces, $cache_backend, $module_handler, $logger);
  }
  $this->database = $database;
  $this->workspaceManager = $workspace_manager;
}