class TestWorkspaceNegotiator

Same name in other branches
  1. 9 core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php \Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator
  2. 8.9.x core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php \Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator
  3. 11.x core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php \Drupal\workspace_update_test\Negotiator\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 14

Namespace

Drupal\workspace_update_test\Negotiator
View source
class TestWorkspaceNegotiator implements WorkspaceNegotiatorInterface, WorkspaceIdNegotiatorInterface {
    
    /**
     * {@inheritdoc}
     */
    public function applies(Request $request) {
        return TRUE;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getActiveWorkspaceId(Request $request) : ?string {
        return 'test';
    }
    
    /**
     * {@inheritdoc}
     */
    public function getActiveWorkspace(Request $request) {
        return Workspace::load($this->getActiveWorkspaceId($request));
    }
    
    /**
     * {@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
TestWorkspaceNegotiator::getActiveWorkspaceId public function Performs workspace negotiation. Overrides WorkspaceIdNegotiatorInterface::getActiveWorkspaceId
TestWorkspaceNegotiator::setActiveWorkspace public function Notifies the negotiator that the workspace ID returned has been accepted. 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.