public static function LingotekWorkbenchController::generateWorkbenchLink in Lingotek Translation 8.2
Same name and namespace in other branches
- 8 src/Controller/LingotekWorkbenchController.php \Drupal\lingotek\Controller\LingotekWorkbenchController::generateWorkbenchLink()
Generates a workbench uri.
Parameters
string $document_id: The Lingotek document id.
string $locale_code: The Lingotek locale.
string $client_id: The Lingotek client id.
string $access_token: The Lingotek access token.
string $login_id: The Lingotek login id.
string $acting_login_id: The Lingotek acting login id.
string $base_url: The site base url.
int|null $expiration: The expiration time of this link.
Return value
string The workbench uri.
Deprecated
Use LingotekWorkbenchRedirectController instead. Since 8.x-2.2.
1 call to LingotekWorkbenchController::generateWorkbenchLink()
- LingotekWorkbenchController::workbenchPageRedirect in src/
Controller/ LingotekWorkbenchController.php - Redirect to the TMS Workbench.
File
- src/
Controller/ LingotekWorkbenchController.php, line 89
Class
- LingotekWorkbenchController
- Class LingotekWorkbenchController.
Namespace
Drupal\lingotek\ControllerCode
public static function generateWorkbenchLink($document_id, $locale_code, $client_id, $access_token, $login_id, $acting_login_id = "anonymous", $base_url = "https://myaccount.lingotek.com", $expiration = NULL) {
// 30-minute default, otherwise use $expiration as passed in.
$expiration_default = time() + 60 * 30;
$expiration = is_null($expiration) ? $expiration_default : $expiration;
$data = [
'document_id' => $document_id,
'locale_code' => $locale_code,
'client_id' => $client_id,
'login_id' => $login_id,
'acting_login_id' => $acting_login_id,
'expiration' => $expiration,
];
$query_data = utf8_encode(http_build_query($data));
$hmac = urlencode(base64_encode(hash_hmac('sha1', $query_data, $access_token, TRUE)));
$workbench_url = $base_url . '/lingopoint/portal/wb.action?' . $query_data . "&hmac=" . $hmac;
return $workbench_url;
}