protected function LingotekTargetStatuses::getTargetActionUrl in Lingotek Translation 8.2
Same name and namespace in other branches
- 3.0.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrl()
- 3.1.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrl()
- 3.2.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrl()
- 3.3.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrl()
- 3.4.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrl()
- 3.5.x src/Element/LingotekTargetStatuses.php \Drupal\lingotek\Element\LingotekTargetStatuses::getTargetActionUrl()
Get the target action url based on the source status.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
string $target_status: The target status.
string $langcode: The language code.
Return value
\Drupal\Core\Url An url object.
1 call to LingotekTargetStatuses::getTargetActionUrl()
- LingotekTargetStatuses::getTranslationsStatuses in src/
Element/ LingotekTargetStatuses.php - Gets the translation status of an entity in a format ready to display.
File
- src/
Element/ LingotekTargetStatuses.php, line 184
Class
- LingotekTargetStatuses
- Provides a Lingotek target status element.
Namespace
Drupal\lingotek\ElementCode
protected function getTargetActionUrl(ContentEntityInterface &$entity, $target_status, $langcode) {
$url = NULL;
$document_id = \Drupal::service('lingotek.content_translation')
->getDocumentId($entity);
$locale = \Drupal::service('lingotek.language_locale_mapper')
->getLocaleForLangcode($langcode);
if ($document_id) {
if ($target_status == Lingotek::STATUS_REQUEST) {
$url = Url::fromRoute('lingotek.entity.request_translation', [
'doc_id' => $document_id,
'locale' => $locale,
], [
'query' => $this
->getDestinationWithQueryArray(),
]);
}
if ($target_status == Lingotek::STATUS_PENDING) {
$url = Url::fromRoute('lingotek.entity.check_target', [
'doc_id' => $document_id,
'locale' => $locale,
], [
'query' => $this
->getDestinationWithQueryArray(),
]);
}
if ($target_status == Lingotek::STATUS_READY || $target_status == Lingotek::STATUS_ERROR) {
$url = Url::fromRoute('lingotek.entity.download', [
'doc_id' => $document_id,
'locale' => $locale,
], [
'query' => $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.entity.request_translation', [
'doc_id' => $document_id,
'locale' => $locale,
], [
'query' => $this
->getDestinationWithQueryArray(),
]);
}
}
return $url;
}