function QueryParameterWorkspaceNegotiator::getQueryToken

Same name in other branches
  1. 10 core/modules/workspaces/src/Negotiator/QueryParameterWorkspaceNegotiator.php \Drupal\workspaces\Negotiator\QueryParameterWorkspaceNegotiator::getQueryToken()

Calculates a token based on a workspace ID.

Parameters

string $workspace_id: The workspace ID.

Return value

string An 8 char token based on the given workspace ID.

1 call to QueryParameterWorkspaceNegotiator::getQueryToken()
QueryParameterWorkspaceNegotiator::getActiveWorkspaceId in core/modules/workspaces/src/Negotiator/QueryParameterWorkspaceNegotiator.php
Performs workspace negotiation.

File

core/modules/workspaces/src/Negotiator/QueryParameterWorkspaceNegotiator.php, line 47

Class

QueryParameterWorkspaceNegotiator
Defines the query parameter workspace negotiator.

Namespace

Drupal\workspaces\Negotiator

Code

protected function getQueryToken(string $workspace_id) : string {
    // Return the first 8 characters.
    return substr(Crypt::hmacBase64($workspace_id, Settings::getHashSalt()), 0, 8);
}

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