RepositoryHandlerManager.php in Workspace 8.2
File
src/RepositoryHandlerManager.php
View source
<?php
namespace Drupal\workspace;
use Drupal\Component\Plugin\FallbackPluginManagerInterface;
use Drupal\Core\Plugin\CategorizingPluginManagerTrait;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
class RepositoryHandlerManager extends DefaultPluginManager implements RepositoryHandlerManagerInterface, FallbackPluginManagerInterface {
use CategorizingPluginManagerTrait;
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/RepositoryHandler', $namespaces, $module_handler, 'Drupal\\workspace\\RepositoryHandlerInterface', 'Drupal\\workspace\\Annotation\\RepositoryHandler');
$this
->alterInfo('workspace_repository_handler_info');
$this
->setCacheBackend($cache_backend, 'workspace_repository_handler');
}
public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id);
$this
->processDefinitionCategory($definition);
}
public function createFromWorkspace(WorkspaceInterface $workspace) {
$target = $workspace->target->value;
$configuration = [
'source' => $workspace
->id(),
'target' => $target,
];
return $this
->createInstance($target, $configuration);
}
public function getFallbackPluginId($plugin_id, array $configuration = []) {
return 'null';
}
}