public function MultiversionIndexFactory::get in Multiversion 8
Same name and namespace in other branches
- 8.2 src/Entity/Index/MultiversionIndexFactory.php \Drupal\multiversion\Entity\Index\MultiversionIndexFactory::get()
File
- src/
Entity/ Index/ MultiversionIndexFactory.php, line 25
Class
Namespace
Drupal\multiversion\Entity\IndexCode
public function get($service, WorkspaceInterface $workspace = null) {
$index = $this->container
->get($service . '.scope');
if ($index instanceof IndexInterface) {
$workspace_id = $workspace ? $workspace
->id() : $this->workspaceManager
->getActiveWorkspaceId();
return $indexes[$workspace_id][$service] = $index
->useWorkspace($workspace_id);
}
else {
throw new \InvalidArgumentException("Service {$service} is not an instance of IndexInterface.");
}
}