QueryParameterWorkspaceNegotiator.php
Same filename in other branches
Namespace
Drupal\workspaces\NegotiatorFile
-
core/
modules/ workspaces/ src/ Negotiator/ QueryParameterWorkspaceNegotiator.php
View source
<?php
namespace Drupal\workspaces\Negotiator;
use Symfony\Component\HttpFoundation\Request;
/**
* Defines the query parameter workspace negotiator.
*/
class QueryParameterWorkspaceNegotiator extends SessionWorkspaceNegotiator {
/**
* {@inheritdoc}
*/
public function applies(Request $request) {
return is_string($request->query
->get('workspace')) && parent::applies($request);
}
/**
* {@inheritdoc}
*/
public function getActiveWorkspace(Request $request) {
$workspace_id = $request->query
->get('workspace');
if ($workspace_id && ($workspace = $this->workspaceStorage
->load($workspace_id))) {
$this->setActiveWorkspace($workspace);
return $workspace;
}
return NULL;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
QueryParameterWorkspaceNegotiator | Defines the query parameter workspace negotiator. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.