ClientAuthorizationPluginManager.php in Entity Share 8.3
File
modules/entity_share_client/src/ClientAuthorization/ClientAuthorizationPluginManager.php
View source
<?php
declare (strict_types=1);
namespace Drupal\entity_share_client\ClientAuthorization;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
class ClientAuthorizationPluginManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/ClientAuthorization', $namespaces, $module_handler, 'Drupal\\entity_share_client\\ClientAuthorization\\ClientAuthorizationInterface', 'Drupal\\entity_share_client\\Annotation\\ClientAuthorization');
$this
->alterInfo('entity_share_client_authorization_info');
$this
->setCacheBackend($cache_backend, 'entity_share_client_authorization_plugins');
}
public function getAvailablePlugins($uuid = '') {
$plugins = [];
$configuration = empty($uuid) ? [] : [
'uuid' => $uuid,
];
$definitions = $this
->getDefinitions();
foreach ($definitions as $definition) {
$plugin = $this
->createInstance($definition['id'], $configuration);
if ($plugin
->checkIfAvailable()) {
$plugins[$plugin
->getPluginId()] = $plugin;
}
}
return $plugins;
}
}