WorkspaceProviderCollector.php
Namespace
Drupal\workspaces\ProviderFile
-
core/
modules/ workspaces/ src/ Provider/ WorkspaceProviderCollector.php
View source
<?php
declare (strict_types=1);
namespace Drupal\workspaces\Provider;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
/**
* Defines the workspace provider collector.
*
* @internal
*/
class WorkspaceProviderCollector {
public function __construct(#[AutowireIterator(tag: 'workspace_provider', defaultIndexMethod: 'getId')] protected iterable $providers) {
$this->providers = iterator_to_array($this->providers);
}
/**
* Gets the workspace provider for the given ID.
*
* @param string $id
* A workspace provider ID.
*
* @return \Drupal\workspaces\Provider\WorkspaceProviderInterface
* The workspace provider.
*/
public function getProvider($id) : WorkspaceProviderInterface {
if (!isset($this->providers[$id])) {
throw new \DomainException("Workspace provider '{$id}' not found.");
}
return $this->providers[$id];
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| WorkspaceProviderCollector | Defines the workspace provider collector. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.