ToolMessagePlacement
in package
Which placements a known LTI message type may carry.
A placement named here is legal only for the message types that list it. A placement that is not named here is a vendor extension and is stored. A message type that is not named here has no rule.
Callers go through assertCompatible(). Do not compare these strings elsewhere.
Table of Contents
Constants
- ALLOWED : array<string, array<string, true>> = array('LtiDeepLinkingRequest' => array( 'Conten...
- IMS Dynamic Registration names ContentArea and RichTextEditor.
- FAMILY : array<string, string> = array('ContentArea' => 'standard', 'RichTextEdi...
- Who uses this placement string. standard is ContentArea and RichTextEditor.
- RECEIVED : array<string, string> = array('editor_button' => 'RichTextEditor', 'con...
- Extensions a received registration stores under another name.
Methods
-
arrange()
: array<int, array{type: string, placements: array
}> - Turn LTI 1.1 launch and placement checkboxes into message rows.
- assertCompatible() : string
- displayPlacements() : array<int, string>
- Labels for a rolled-up placement list. Standard names come first.
- foldReceivedPlacements() : array<string, mixed>
- Rewrite a received extension to the placement this message stores.
- knownMessageTypes() : array<int, string>
- Message types the course editor can add.
- knownPlacements() : array<int, string>
- Placements this message type may carry. An unknown type has none.
- launchesForCheckbox() : array<int, string>
- Launch checkboxes that can carry this placement. One placement may fit both.
- isKnownPlacement() : bool
- messageSelection() : array<string, true>
- receivedPlacement() : string
Constants
ALLOWED
IMS Dynamic Registration names ContentArea and RichTextEditor.
private
array<string, array<string, true>>
ALLOWED
= array('LtiDeepLinkingRequest' => array(
'ContentArea' => true,
'RichTextEditor' => true,
'assignment_selection' => true,
'link_selection' => true,
'content_editor' => true,
'editor_button' => true,
'migration_selection' => true,
'homework_submission' => true,
// Lessons, the editor, and assignments also work on a resource link.
// A cartridge response is content-item only, like Sakai's import item.
'lessons' => true,
'common_cartridge' => true,
), 'LtiResourceLinkRequest' => array('ContentArea' => true, 'RichTextEditor' => true, 'course_navigation' => true, 'account_navigation' => true, 'user_navigation' => true, 'global_navigation' => true, 'lessons' => true, 'content_editor' => true, 'assignment_selection' => true))
Canvas uses its own strings, such as course_navigation and link_selection. lessons and content_editor are Tsugi/Sakai placements. common_cartridge is too, and a received registration stores it as Canvas migration_selection. A name that is not listed here is still stored. It is not rejected.
FAMILY
Who uses this placement string. standard is ContentArea and RichTextEditor.
private
array<string, string>
FAMILY
= array('ContentArea' => 'standard', 'RichTextEditor' => 'standard', 'account_navigation' => 'canvas', 'assignment_selection' => 'canvas', 'course_navigation' => 'canvas', 'editor_button' => 'canvas', 'global_navigation' => 'canvas', 'homework_submission' => 'canvas', 'link_selection' => 'canvas', 'migration_selection' => 'canvas', 'user_navigation' => 'canvas', 'common_cartridge' => 'tsugi', 'content_editor' => 'tsugi', 'lessons' => 'tsugi')
canvas and tsugi are extensions. A name that is absent here is unclassified.
RECEIVED
Extensions a received registration stores under another name.
private
array<string, string>
RECEIVED
= array('editor_button' => 'RichTextEditor', 'content_editor' => 'RichTextEditor', 'lessons' => 'ContentArea', 'common_cartridge' => 'migration_selection')
editor_button is Canvas's rich text editor placement. content_editor is the Tsugi/Sakai rich text editor placement. lessons is the Tsugi/Sakai content area placement. common_cartridge is the Tsugi/Sakai cartridge placement. Import stores it as Canvas migration_selection. The registration Tsugi sends still includes the extension strings. Canvas and Sakai select the tool by the extension, and the other name is added beside it. Import keeps each stored name once.
Methods
arrange()
Turn LTI 1.1 launch and placement checkboxes into message rows.
public
static arrange(mixed $messageTypes, mixed $placements) : array<int, array{type: string, placements: array}>
Resource link and content item are independent. At least one is required. A privacy launch is a third message and does not satisfy that rule. A placement is stored on every selected launch that can carry it. Lessons, the editor, and assignments work on a resource link or a content item. Course navigation requires a resource link. A cartridge response requires a content item. LTI 1.1 calls this launch a content item. The stored message type is still LtiDeepLinkingRequest.
Parameters
- $messageTypes : mixed
- $placements : mixed
Return values
array<int, array{type: string, placements: arrayassertCompatible()
public
static assertCompatible(string $messageType, mixed $placement) : string
Parameters
- $messageType : string
- $placement : mixed
Return values
stringdisplayPlacements()
Labels for a rolled-up placement list. Standard names come first.
public
static displayPlacements(array<int, mixed> $names) : array<int, string>
Canvas and Tsugi/Sakai names keep their identifier and gain a note.
Parameters
- $names : array<int, mixed>
Return values
array<int, string>foldReceivedPlacements()
Rewrite a received extension to the placement this message stores.
public
static foldReceivedPlacements(array<string, mixed> $document) : array<string, mixed>
A target this message type cannot carry stays as the extension. Other placement strings are unchanged. Repeated names collapse to one.
Parameters
- $document : array<string, mixed>
Return values
array<string, mixed>knownMessageTypes()
Message types the course editor can add.
public
static knownMessageTypes() : array<int, string>
Return values
array<int, string>knownPlacements()
Placements this message type may carry. An unknown type has none.
public
static knownPlacements(string $messageType) : array<int, string>
Parameters
- $messageType : string
Return values
array<int, string>launchesForCheckbox()
Launch checkboxes that can carry this placement. One placement may fit both.
public
static launchesForCheckbox(string $placement) : array<int, string>
Parameters
- $placement : string
Return values
array<int, string>isKnownPlacement()
private
static isKnownPlacement(string $placement) : bool
Parameters
- $placement : string
Return values
boolmessageSelection()
private
static messageSelection(mixed $messageTypes) : array<string, true>
Parameters
- $messageTypes : mixed
Return values
array<string, true>receivedPlacement()
private
static receivedPlacement(string $messageType, string $placement) : string
Parameters
- $messageType : string
- $placement : string