You are here

protected function LingotekConfigTranslationController::redirectToEntityTranslateOverview in Lingotek Translation 3.0.x

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

Redirect to config entity translation overview page.

Parameters

string $entity_type: The config entity type id.

string $entity_id: The config entity id.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect response.

6 calls to LingotekConfigTranslationController::redirectToEntityTranslateOverview()
LingotekConfigTranslationController::checkDownload in src/Controller/LingotekConfigTranslationController.php
LingotekConfigTranslationController::checkUpload in src/Controller/LingotekConfigTranslationController.php
LingotekConfigTranslationController::download in src/Controller/LingotekConfigTranslationController.php
LingotekConfigTranslationController::request in src/Controller/LingotekConfigTranslationController.php
LingotekConfigTranslationController::update in src/Controller/LingotekConfigTranslationController.php

... See full list

File

src/Controller/LingotekConfigTranslationController.php, line 565

Class

LingotekConfigTranslationController

Namespace

Drupal\lingotek\Controller

Code

protected function redirectToEntityTranslateOverview($entity_type, $entity_id) {
  $mappers = $this->configMapperManager
    ->getMappers();
  if ($entity_type === 'field_config') {
    $field_config = FieldConfig::load($entity_id);
    $id = $field_config
      ->getTargetEntityTypeId();
    $mapper = $mappers[$id . '_fields'];
    $mapper
      ->setEntity($field_config);
    $entity_definition = $this->entityTypeManager
      ->getDefinition($id);
    $uri = Url::fromRoute($mapper
      ->getOverviewRouteName(), [
      $entity_type => $entity_id,
      $entity_definition
        ->getBundleEntityType() => $field_config
        ->getTargetBundle(),
    ]);
  }
  else {
    $mapper = $mappers[$entity_type];
    $uri = Url::fromRoute($mapper
      ->getOverviewRouteName(), [
      $entity_type => $entity_id,
    ]);
  }
  return new RedirectResponse($uri
    ->setAbsolute(TRUE)
    ->toString());
}