public function LingotekManagementController::content in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 4.0.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.0.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.1.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.2.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.3.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.4.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.5.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.6.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.7.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
- 3.8.x src/Controller/LingotekManagementController.php \Drupal\lingotek\Controller\LingotekManagementController::content()
1 string reference to 'LingotekManagementController::content'
File
- src/
Controller/ LingotekManagementController.php, line 7
Class
Namespace
Drupal\lingotek\ControllerCode
public function content() {
if ($redirect = $this
->checkSetup()) {
return $redirect;
}
$entity_types = \Drupal::service('lingotek.configuration')
->getEnabledEntityTypes();
$entity_type_id = NULL;
if (!empty($entity_types)) {
// Prioritize node as main content type.
if (array_key_exists('node', $entity_types)) {
$entity_type_id = 'node';
}
else {
$entity_type_keys = array_keys($entity_types);
$entity_type_id = reset($entity_type_keys);
}
}
if ($entity_type_id) {
return $this
->redirect("lingotek.manage.{$entity_type_id}");
}
$build['enable_content_translation']['#markup'] = $this
->t('You need to enable content translation first. You can enable translation for the desired content entities on the <a href=":translation-entity">Content language</a> page.', [
':translation-entity' => \Drupal::url('language.content_settings_page'),
]) . '<br/>';
$build['enable_lingotek']['#markup'] = $this
->t('Then you need to configure how you want to translate your content with Lingotek. Enable translation for the desired content entities on the <a href=":lingotek-translation-entity">Lingotek settings</a> page.', [
':lingotek-translation-entity' => \Drupal::url('lingotek.settings'),
]);
return $build;
}