protected function LingotekTargetStatuses::getTargetActionUrlForUI in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 4.0.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrlForUI()
- 3.3.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrlForUI()
- 3.4.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrlForUI()
- 3.5.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrlForUI()
- 3.6.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrlForUI()
- 3.7.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrlForUI()
- 3.8.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrlForUI()
1 call to LingotekTargetStatuses::getTargetActionUrlForUI()
File
- src/
Element/ LingotekTargetStatuses.php, line 271
Class
- LingotekTargetStatuses
- Provides a Lingotek target status element.
Namespace
Drupal\lingotek\ElementCode
protected function getTargetActionUrlForUI($component, $target_status, $langcode) {
$url = NULL;
$document_id = \Drupal::service('lingotek.interface_translation')
->getDocumentId($component);
$locale = \Drupal::service('lingotek.language_locale_mapper')
->getLocaleForLangcode($langcode);
if ($document_id) {
if ($target_status == Lingotek::STATUS_REQUEST) {
$url = Url::fromRoute('lingotek.interface_translation.request_translation', [], [
'query' => [
'component' => $component,
'locale' => $locale,
] + $this
->getDestinationWithQueryArray(),
]);
}
if ($target_status == Lingotek::STATUS_PENDING) {
$url = Url::fromRoute('lingotek.interface_translation.check_translation', [], [
'query' => [
'component' => $component,
'locale' => $locale,
] + $this
->getDestinationWithQueryArray(),
]);
}
if ($target_status == Lingotek::STATUS_READY || $target_status == Lingotek::STATUS_ERROR) {
$url = Url::fromRoute('lingotek.interface_translation.download', [], [
'query' => [
'component' => $component,
'locale' => $locale,
] + $this
->getDestinationWithQueryArray(),
]);
}
if ($target_status == Lingotek::STATUS_CURRENT || $target_status == Lingotek::STATUS_INTERMEDIATE || $target_status == Lingotek::STATUS_EDITED) {
$url = Url::fromRoute('lingotek.workbench', [
'doc_id' => $document_id,
'locale' => $locale,
]);
}
if ($target_status == Lingotek::STATUS_UNTRACKED) {
$url = Url::fromRoute('lingotek.interface_translation.request_translation', [], [
'query' => [
'component' => $component,
'locale' => $locale,
] + $this
->getDestinationWithQueryArray(),
]);
}
}
return $url;
}