You are here

protected function LingotekSourceStatus::getSourceActionUrlForUI in Lingotek Translation 3.2.x

Same name and namespace in other branches
  1. 4.0.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrlForUI()
  2. 3.3.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrlForUI()
  3. 3.4.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrlForUI()
  4. 3.5.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrlForUI()
  5. 3.6.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrlForUI()
  6. 3.7.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrlForUI()
  7. 3.8.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrlForUI()
1 call to LingotekSourceStatus::getSourceActionUrlForUI()
LingotekSourceStatus::preRender in src/Element/LingotekSourceStatus.php
Calculates the url and status title and adds them to the render array.

File

src/Element/LingotekSourceStatus.php, line 94

Class

LingotekSourceStatus
Provides a Lingotek source status element.

Namespace

Drupal\lingotek\Element

Code

protected function getSourceActionUrlForUI($component, $source_status) {
  $url = NULL;
  if ($source_status == Lingotek::STATUS_IMPORTING) {
    $url = Url::fromRoute('lingotek.interface_translation.check_upload', [], [
      'query' => [
        'component' => $component,
      ] + $this
        ->getDestinationWithQueryArray(),
    ]);
  }
  if ($source_status == Lingotek::STATUS_EDITED || $source_status == Lingotek::STATUS_UNTRACKED || $source_status == Lingotek::STATUS_ERROR || $source_status == Lingotek::STATUS_CANCELLED) {
    if ($doc_id = \Drupal::service('lingotek.interface_translation')
      ->getDocumentId($component)) {
      $url = Url::fromRoute('lingotek.interface_translation.update', [], [
        'query' => [
          'component' => $component,
        ] + $this
          ->getDestinationWithQueryArray(),
      ]);
    }
    else {
      $url = Url::fromRoute('lingotek.interface_translation.upload', [], [
        'query' => [
          'component' => $component,
        ] + $this
          ->getDestinationWithQueryArray(),
      ]);
    }
  }
  return $url;
}