public function LingotekSetupController::communityPage in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8 src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 8.2 src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 4.0.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.0.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.1.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.3.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.4.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.5.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.6.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.7.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
- 3.8.x src/Controller/LingotekSetupController.php \Drupal\lingotek\Controller\LingotekSetupController::communityPage()
1 string reference to 'LingotekSetupController::communityPage'
File
- src/
Controller/ LingotekSetupController.php, line 54
Class
- LingotekSetupController
- Returns responses for lingotek module setup routes.
Namespace
Drupal\lingotek\ControllerCode
public function communityPage() {
if ($redirect = $this
->checkSetup()) {
return $redirect;
}
$communities = $this->lingotek
->getCommunities(TRUE);
if (empty($communities)) {
// TODO: Log an error that no communities exist.
return $this
->redirect('lingotek.setup_account');
}
$config = \Drupal::configFactory()
->getEditable('lingotek.settings');
$config
->set('account.resources.community', $communities);
$config
->save();
if (count($communities) == 1) {
// No choice necessary. Save and advance to next page.
$config
->set('default.community', current(array_keys($communities)));
$config
->save();
// update resources based on newly selected community
$this->lingotek
->getResources(TRUE);
return $this
->redirect('lingotek.setup_defaults');
}
return [
'#type' => 'markup',
'markup' => $this->formBuilder
->getForm(LingotekSettingsCommunityForm::class),
];
}