public function WorkspaceManager::executeOutsideWorkspace in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::executeOutsideWorkspace()
Executes the given callback function without any workspace context.
Parameters
callable $function: The callback to be executed.
Return value
mixed The callable's return value.
Overrides WorkspaceManagerInterface::executeOutsideWorkspace
File
- core/
modules/ workspaces/ src/ WorkspaceManager.php, line 297
Class
- WorkspaceManager
- Provides the workspace manager.
Namespace
Drupal\workspacesCode
public function executeOutsideWorkspace(callable $function) {
$previous_active_workspace = $this
->getActiveWorkspace();
$this
->doSwitchWorkspace(NULL);
$result = $function();
$this
->doSwitchWorkspace($previous_active_workspace);
return $result;
}