public function LingotekSetupController::defaultsPage in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 4.0.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.0.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.1.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.2.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.3.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.4.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.5.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.6.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.7.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
- 3.8.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::defaultsPage()
1 string reference to 'LingotekSetupController::defaultsPage'
File
- src/
Controller/ LingotekSetupController.php, line 86
Class
- LingotekSetupController
- Returns responses for lingotek module setup routes.
Namespace
Drupal\lingotek\ControllerCode
public function defaultsPage() {
if ($redirect = $this
->checkSetup()) {
return $redirect;
}
$resources = $this->lingotek
->getResources();
// No choice necessary. Save and advance to the next page.
if (count($resources['project']) == 1 && count($resources['vault']) == 1) {
$this->lingotek
->set('default.project', current(array_keys($resources['project'])));
$this->lingotek
->set('default.vault', current(array_keys($resources['vault'])));
$this->lingotek
->set('default.workflow', array_search('Machine Translation', $resources['workflow']));
// Assign the project callback
$new_callback_url = \Drupal::urlGenerator()
->generateFromRoute('lingotek.notify', [], [
'absolute' => TRUE,
]);
$this->lingotek
->set('account.callback_url', $new_callback_url);
$new_response = $this->lingotek
->setProjectCallBackUrl($this->lingotek
->get('default.project'), $new_callback_url);
return $this
->redirect('lingotek.dashboard');
}
return array(
'#type' => 'markup',
'markup' => $this
->getLingotekForm('LingotekSettingsDefaultsForm'),
);
}