You are here

public function LingotekTranslationStatusController::renderTargetStatus in Lingotek Translation 3.2.x

Same name and namespace in other branches
  1. 8.2 tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  2. 4.0.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  3. 3.0.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  4. 3.1.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  5. 3.3.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  6. 3.4.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  7. 3.5.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  8. 3.6.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  9. 3.7.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()
  10. 3.8.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderTargetStatus()

Renders the Lingotek target status of the given entity.

Parameters

string $entity_type: The entity type id from the entity which status we want to render.

string $entity_id: The entity id from the entity which status we want to render.

\Symfony\Component\HttpFoundation\Request $request: The HTTP request.

Return value

array A render array including a lingotek_target_status element.

1 string reference to 'LingotekTranslationStatusController::renderTargetStatus'
lingotek_form_test.routing.yml in tests/modules/lingotek_form_test/lingotek_form_test.routing.yml
tests/modules/lingotek_form_test/lingotek_form_test.routing.yml

File

tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php, line 58

Class

LingotekTranslationStatusController
Controller for rendering the translation status of an entity for tests.

Namespace

Drupal\lingotek_form_test\Controller

Code

public function renderTargetStatus($entity_type, $entity_id, Request $request) {
  $entity = \Drupal::entityTypeManager()
    ->getStorage($entity_type)
    ->load($entity_id);
  $elements = [
    '#cache' => [
      'max-age' => 0,
    ],
  ];

  /** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
  $translation_service = \Drupal::service('lingotek.content_translation');
  $statuses = $translation_service
    ->getTargetStatuses($entity);
  foreach ($statuses as $langcode => $status) {
    $elements[$langcode] = [
      '#type' => 'lingotek_target_status',
      '#entity' => $entity,
      '#language' => $langcode,
      '#status' => $status,
    ];
  }
  return $elements;
}