Skip to content

Commit

Permalink
Support no data and add iframe settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
etsikt committed Nov 3, 2021
1 parent 3a192de commit eb6a4fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lti/LTI_Deep_Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public function __construct($registration, $deployment_id, $deep_link_settings)
}

public function get_response_jwt($resources) {
$data = "{}";
if(isset($this->deep_link_settings['data'])) {
$data = $this->deep_link_settings['data'];
}
$message_jwt = [
"iss" => $this->registration->get_client_id(),
"aud" => [$this->registration->get_issuer()],
Expand All @@ -25,7 +29,7 @@ public function get_response_jwt($resources) {
"https://purl.imsglobal.org/spec/lti/claim/message_type" => "LtiDeepLinkingResponse",
"https://purl.imsglobal.org/spec/lti/claim/version" => "1.3.0",
"https://purl.imsglobal.org/spec/lti-dl/claim/content_items" => array_map(function($resource) { return $resource->to_array(); }, $resources),
"https://purl.imsglobal.org/spec/lti-dl/claim/data" => $this->deep_link_settings['data'],
"https://purl.imsglobal.org/spec/lti-dl/claim/data" => $data,
];
return JWT::encode($message_jwt, $this->registration->get_tool_private_key(), 'RS256', $this->registration->get_kid());
}
Expand Down
4 changes: 4 additions & 0 deletions src/lti/LTI_Deep_Link_Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public function to_array() {
"presentation" => [
"documentTarget" => $this->target,
],
"iframe" => [
"width" => 1000,
"height" => 400
],
"custom" => $this->custom_params,
];
if ($this->lineitem !== null) {
Expand Down

0 comments on commit eb6a4fb

Please sign in to comment.