You are here

protected function LingotekConfigTranslationController::generateOperationsLinks in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 8 src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  2. 8.2 src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  3. 4.0.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  4. 3.0.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  5. 3.1.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  6. 3.2.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  7. 3.3.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  8. 3.4.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  9. 3.5.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  10. 3.6.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()
  11. 3.7.x src/Controller/LingotekConfigTranslationController.php \Drupal\lingotek\Controller\LingotekConfigTranslationController::generateOperationsLinks()

Generates the operation links for each language.

Parameters

array &$page: The reference of the page build render array where we need to add the links to.

string $plugin_id: The plugin id, which is needed for building the link. It could be the entity type id or the plugin id of the config mapper.

string $entity_id: The entity id. If it's a config mapper and not an entity, it would be the plugin id.

int $target_status: The target status for this language. This way we decide which link must be shown.

$langcode: The langcode of the translation we are building the link to. Used for keying the link in the page array.

$locale: Lingotek locale we are creating the link for. Used for building the link itself.

1 call to LingotekConfigTranslationController::generateOperationsLinks()
LingotekConfigTranslationController::itemPage in src/Controller/LingotekConfigTranslationController.php
Language translations overview page for a configuration name.

File

src/Controller/LingotekConfigTranslationController.php, line 698

Class

LingotekConfigTranslationController

Namespace

Drupal\lingotek\Controller

Code

protected function generateOperationsLinks(&$page, $plugin_id, $entity_id, $target_status, $langcode, $locale) {
  $route_params = [
    'entity_type' => $plugin_id,
    'entity_id' => $entity_id,
    'locale' => $locale,
  ];
  if ($target_status === NULL || $target_status == Lingotek::STATUS_REQUEST || $target_status == Lingotek::STATUS_EDITED || $target_status == Lingotek::STATUS_UNTRACKED) {
    $page['languages'][$langcode]['operations']['#links']['request'] = [
      'title' => $this
        ->t('Request translation'),
      'url' => Url::fromRoute('lingotek.config.request', $route_params),
    ];
  }
  elseif ($target_status == Lingotek::STATUS_PENDING) {
    $page['languages'][$langcode]['operations']['#links']['check_download'] = [
      'title' => $this
        ->t('Check Download'),
      'url' => Url::fromRoute('lingotek.config.check_download', $route_params),
    ];
  }
  elseif ($target_status == Lingotek::STATUS_READY) {
    $page['languages'][$langcode]['operations']['#links']['download'] = [
      'title' => $this
        ->t('Download'),
      'url' => Url::fromRoute('lingotek.config.download', $route_params),
    ];
  }
}