public function LTIToolProviderController::ltiReturn in LTI Tool Provider 8
Same name and namespace in other branches
- 2.x src/Controller/LTIToolProviderController.php \Drupal\lti_tool_provider\Controller\LTIToolProviderController::ltiReturn()
LTI return.
Logs the user out and returns the user to the LMS.
Return value
RedirectResponse Redirect user to appropriate return url.
1 string reference to 'LTIToolProviderController::ltiReturn'
File
- src/
Controller/ LTIToolProviderController.php, line 212
Class
- LTIToolProviderController
- Returns responses for lti_tool_provider module routes.
Namespace
Drupal\lti_tool_provider\ControllerCode
public function ltiReturn() {
try {
$destination = '/';
if (empty($this->context)) {
throw new Exception('LTI context missing in return request.');
}
if (!empty($this->destination)) {
$destination = $this->destination;
}
if (isset($this->context['launch_presentation_return_url']) && !empty($this->context['launch_presentation_return_url'])) {
$destination = $this->context['launch_presentation_return_url'];
}
$this->killSwitch
->trigger();
$event = new LtiToolProviderReturnEvent($this->context, $destination);
LtiToolProviderEvent::dispatchEvent($this->eventDispatcher, $event);
if ($event
->isCancelled()) {
throw new Exception($event
->getMessage());
}
$destination = $event
->getDestination();
$this
->userLogout();
return new TrustedRedirectResponse($destination);
} catch (Exception $e) {
$this->loggerFactory
->warning($e
->getMessage());
return new RedirectResponse('/', 500);
}
}