You are here

protected function LingotekManagementForm::getTargetActionUrl in Lingotek Translation 8

1 call to LingotekManagementForm::getTargetActionUrl()
LingotekManagementForm::getTranslationsStatuses in src/Form/LingotekManagementForm.php
Gets the translation status of an entity in a format ready to display.

File

src/Form/LingotekManagementForm.php, line 1236
Contains \Drupal\Lingotek\Form\LingotekManagementForm.

Class

LingotekManagementForm
Form for bulk management of content.

Namespace

Drupal\lingotek\Form

Code

protected function getTargetActionUrl(ContentEntityInterface &$entity, $target_status, $langcode) {
  $url = NULL;
  $document_id = $this->translationService
    ->getDocumentId($entity);
  $locale = $this->languageLocaleMapper
    ->getLocaleForLangcode($langcode);
  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) {
    $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;
}