public function LtiToolProviderEvent::sendLtiError in LTI Tool Provider 8
Same name and namespace in other branches
- 2.x src/LtiToolProviderEvent.php \Drupal\lti_tool_provider\LtiToolProviderEvent::sendLtiError()
Send an error back to the LMS.
Parameters
array $context: The LTI context.
string $message: The error message to send.
File
- src/
LtiToolProviderEvent.php, line 73
Class
Namespace
Drupal\lti_tool_providerCode
public function sendLtiError(array $context, string $message) {
if (isset($context['launch_presentation_return_url']) && !empty($context['launch_presentation_return_url'])) {
$url = Url::fromUri($context['launch_presentation_return_url'])
->setOption('query', [
'lti_errormsg' => $message,
])
->setAbsolute(true)
->toString();
$response = new RedirectResponse($url);
$response
->send();
}
}