class WorkspaceProviderCollector

Defines the workspace provider collector.

@internal

Hierarchy

Expanded class hierarchy of WorkspaceProviderCollector

1 file declares its use of WorkspaceProviderCollector
Workspace.php in core/modules/workspaces/src/Entity/Workspace.php

File

core/modules/workspaces/src/Provider/WorkspaceProviderCollector.php, line 14

Namespace

Drupal\workspaces\Provider
View source
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];
  }

}

Members

Title Sort descending Modifiers Object type Summary
WorkspaceProviderCollector::getProvider public function Gets the workspace provider for the given ID.
WorkspaceProviderCollector::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.