You are here

public function LingotekTranslationStatusController::renderSource 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::renderSource()
  2. 4.0.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  3. 3.0.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  4. 3.1.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  5. 3.3.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  6. 3.4.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  7. 3.5.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  8. 3.6.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  9. 3.7.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()
  10. 3.8.x tests/modules/lingotek_form_test/src/Controller/LingotekTranslationStatusController.php \Drupal\lingotek_form_test\Controller\LingotekTranslationStatusController::renderSource()

Renders the Lingotek source 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_source_status element.

1 string reference to 'LingotekTranslationStatusController::renderSource'
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 29

Class

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

Namespace

Drupal\lingotek_form_test\Controller

Code

public function renderSource($entity_type, $entity_id, Request $request) {
  $entity = \Drupal::entityTypeManager()
    ->getStorage($entity_type)
    ->load($entity_id);

  /** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $translation_service */
  $translation_service = \Drupal::service('lingotek.content_translation');
  $status = $translation_service
    ->getSourceStatus($entity);
  return [
    '#type' => 'lingotek_source_status',
    '#entity' => $entity,
    '#language' => $entity
      ->language(),
    '#status' => $status,
  ];
}