function lingotek_get_workbench_url in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.remote.inc \lingotek_get_workbench_url()
- 7.2 lingotek.api.inc \lingotek_get_workbench_url()
- 7.3 lingotek.api.inc \lingotek_get_workbench_url()
- 7.4 lingotek.api.inc \lingotek_get_workbench_url()
- 7.5 lingotek.remote.inc \lingotek_get_workbench_url()
Get the url to open the Lingotek Workbench.
This fetches a link.
Parameters
object $node: A Drupal node.
$lingotek_locale: A target language.
mixed $label: The label to use as text for the link. Possible values are TRUE, FALSE, or a string to use as a the custom label for the link.
bool $force: Force the link to use the label of the first returned workflow phase for the target Document.
Return value
string Either a link pointing the the url, or the url itself if $label is FALSE
2 calls to lingotek_get_workbench_url()
- lingotek_node_view in ./
lingotek.module - Implements hook_node_view().
- lingotek_workbench_redirect in ./
lingotek.page.inc
File
- ./
lingotek.remote.inc, line 652
Code
function lingotek_get_workbench_url($document_id, $lingotek_locale, $label = FALSE, $force = FALSE) {
if ($lingotek_locale === FALSE) {
return "";
}
$api = LingotekApi::instance();
$targets = lingotek_get_document_targets($document_id, TRUE);
//Make sure we get the current phases for the links and not out of date ones (so caches don't combine)
if (count($targets) == 0) {
return '';
}
foreach ($targets as $lang => $translation_target) {
if ($lang != $lingotek_locale) {
continue;
}
$target = $api
->getTranslationTarget($translation_target->id);
$phases = $target ? $target->phases : array();
return lingotek_get_workbench_url_by_phases($document_id, $phases, $label, $force);
}
LingotekLog::error('lingotek_get_workbench_url - Specified language target not found', $document_id);
return '';
}