class TestWorkspaceNegotiator

Defines a workspace negotiator used for testing.

Hierarchy

Expanded class hierarchy of TestWorkspaceNegotiator

1 string reference to 'TestWorkspaceNegotiator'
workspace_update_test.services.yml in core/modules/workspaces/tests/modules/workspace_update_test/workspace_update_test.services.yml
core/modules/workspaces/tests/modules/workspace_update_test/workspace_update_test.services.yml
1 service uses TestWorkspaceNegotiator
workspace_update_test.negotiator.test in core/modules/workspaces/tests/modules/workspace_update_test/workspace_update_test.services.yml
Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator

File

core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php, line 13

Namespace

Drupal\workspace_update_test\Negotiator
View source
class TestWorkspaceNegotiator implements WorkspaceNegotiatorInterface {
  
  /**
   * {@inheritdoc}
   */
  public function applies(Request $request) {
    return TRUE;
  }
  
  /**
   * {@inheritdoc}
   */
  public function getActiveWorkspace(Request $request) {
    return Workspace::create([
      'id' => 'test',
      'label' => 'Test',
    ]);
  }
  
  /**
   * {@inheritdoc}
   */
  public function setActiveWorkspace(WorkspaceInterface $workspace) {
    // Nothing to do here.
  }
  
  /**
   * {@inheritdoc}
   */
  public function unsetActiveWorkspace() {
    // Nothing to do here.
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
TestWorkspaceNegotiator::applies public function Checks whether the negotiator applies to the current request or not. Overrides WorkspaceNegotiatorInterface::applies
TestWorkspaceNegotiator::getActiveWorkspace public function Gets the negotiated workspace, if any. Overrides WorkspaceNegotiatorInterface::getActiveWorkspace
TestWorkspaceNegotiator::setActiveWorkspace public function Sets the negotiated workspace. Overrides WorkspaceNegotiatorInterface::setActiveWorkspace
TestWorkspaceNegotiator::unsetActiveWorkspace public function Unsets the negotiated workspace. Overrides WorkspaceNegotiatorInterface::unsetActiveWorkspace

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