You are here

protected function LTIToolProvider::sendLtiError in LTI Tool Provider 8

Same name and namespace in other branches
  1. 2.x src/Authentication/Provider/LTIToolProvider.php \Drupal\lti_tool_provider\Authentication\Provider\LTIToolProvider::sendLtiError()

Send an error back to the LMS.

Parameters

string $message: The error message to send.

2 calls to LTIToolProvider::sendLtiError()
LTIToolProvider::authenticate in src/Authentication/Provider/LTIToolProvider.php
Authenticates the user.
LTIToolProvider::provisionUser in src/Authentication/Provider/LTIToolProvider.php
Provision a user that matches the LTI request context info.

File

src/Authentication/Provider/LTIToolProvider.php, line 356

Class

LTIToolProvider
Oauth authentication provider for LTI Tool Provider.

Namespace

Drupal\lti_tool_provider\Authentication\Provider

Code

protected function sendLtiError(string $message) {
  if (isset($this->context['launch_presentation_return_url']) && !empty($this->context['launch_presentation_return_url'])) {
    $url = Url::fromUri($this->context['launch_presentation_return_url'])
      ->setOption('query', [
      'lti_errormsg' => $message,
    ])
      ->setAbsolute(true)
      ->toString();
    $response = new RedirectResponse($url);
    $response
      ->send();
  }
}