public function LanguageSelectionPageController::main in Language Selection Page 8.2
Page callback.
File
- src/
Controller/ LanguageSelectionPageController.php, line 110
Class
- LanguageSelectionPageController
- The LanguageSelectionPageController class.
Namespace
Drupal\language_selection_page\ControllerCode
public function main() {
$config = $this
->config('language_selection_page.negotiation');
$destination = $this
->getDestination();
// Check $destination is valid.
// If the path is set to $destination, redirect the user to the
// front page to avoid infinite loops.
if (empty($destination) || trim($destination, '/') === trim($config
->get('path'), '/')) {
return new RedirectResponse(Url::fromRoute('<front>')
->setAbsolute()
->toString());
}
return $this
->getPageResponse($this
->getPageContent($destination));
}