You are here

public function ClientAuthorizationPluginManager::getAvailablePlugins in Entity Share 8.3

Builds an array of currently available plugin instances.

Parameters

string $uuid: Allow the uuid to be explicitly set.

Return value

\Drupal\entity_share_client\ClientAuthorization\ClientAuthorizationInterface[] The array of plugins.

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

modules/entity_share_client/src/ClientAuthorization/ClientAuthorizationPluginManager.php, line 45

Class

ClientAuthorizationPluginManager
Provides the Client authorization plugin manager.

Namespace

Drupal\entity_share_client\ClientAuthorization

Code

public function getAvailablePlugins($uuid = '') {
  $plugins = [];
  $configuration = empty($uuid) ? [] : [
    'uuid' => $uuid,
  ];
  $definitions = $this
    ->getDefinitions();
  foreach ($definitions as $definition) {

    /** @var \Drupal\entity_share_client\ClientAuthorization\ClientAuthorizationInterface $plugin */
    $plugin = $this
      ->createInstance($definition['id'], $configuration);
    if ($plugin
      ->checkIfAvailable()) {
      $plugins[$plugin
        ->getPluginId()] = $plugin;
    }
  }
  return $plugins;
}