Documentation

UpdateModuleItemDTO extends AbstractBaseDto
in package
implements DTOInterface

Update Module Item DTO

Data Transfer Object for updating Canvas module items. Similar to CreateModuleItemDTO but all properties are optional.

Usage:

// Update module item title and position
$dto = new UpdateModuleItemDTO([
    'title' => 'Updated Assignment Title',
    'position' => 2
]);

// Update external tool configuration
$dto = new UpdateModuleItemDTO([
    'external_url' => 'https://updated-tool.com',
    'iframe' => ['width' => 1000, 'height' => 800]
]);

// Update completion requirements
$dto = new UpdateModuleItemDTO([
    'completion_requirement' => [
        'type' => 'min_score',
        'min_score' => 80
    ]
]);

Table of Contents

Interfaces

DTOInterface

Properties

$completionRequirement  : array<string, mixed>|null
Completion requirement configuration.
$contentId  : int|null
ID of associated content object.
$externalUrl  : string|null
External URL for ExternalUrl/ExternalTool types.
$iframe  : array<string, int>|null
External tool iframe configuration (ExternalTool only).
$indent  : int|null
0-based hierarchy indent level (0-5 allowed).
$newTab  : bool|null
Whether external tool opens in new tab (ExternalTool only).
$pageUrl  : string|null
Wiki page URL slug (Page type).
$position  : int|null
1-based position in module.
$title  : string|null
Item title.
$type  : string|null
Content type (File, Page, Discussion, Assignment, Quiz, SubHeader, ExternalUrl, ExternalTool).
$apiPropertyName  : string
Canvas API property name for module items

Methods

__construct()  : mixed
BaseDto constructor.
getCompletionRequirement()  : array<string, mixed>|null
getContentId()  : int|null
getExternalUrl()  : string|null
getIframe()  : array<string, int>|null
getIndent()  : int|null
getNewTab()  : bool|null
getPageUrl()  : string|null
getPosition()  : int|null
getTitle()  : string|null
getType()  : string|null
setCompletionRequirement()  : void
setContentId()  : void
setExternalUrl()  : void
setIframe()  : void
setIndent()  : void
setNewTab()  : void
setPageUrl()  : void
setPosition()  : void
setTitle()  : void
setType()  : void
toApiArray()  : array<string|int, mixed>
Convert the DTO to an array for API requests Handles nested arrays for iframe and completion_requirement
toArray()  : array<string|int, mixed>
Convert the DTO to an array

Properties

$completionRequirement

Completion requirement configuration.

public array<string, mixed>|null $completionRequirement = null

Structure: ['type' => 'must_view|must_contribute|must_submit|min_score|must_mark_done', 'min_score' => int]

$externalUrl

External URL for ExternalUrl/ExternalTool types.

public string|null $externalUrl = null

$iframe

External tool iframe configuration (ExternalTool only).

public array<string, int>|null $iframe = null

Structure: ['width' => int, 'height' => int]

$indent

0-based hierarchy indent level (0-5 allowed).

public int|null $indent = null

$newTab

Whether external tool opens in new tab (ExternalTool only).

public bool|null $newTab = null

$type

Content type (File, Page, Discussion, Assignment, Quiz, SubHeader, ExternalUrl, ExternalTool).

public string|null $type = null

$apiPropertyName

Canvas API property name for module items

protected string $apiPropertyName = 'module_item'

Methods

__construct()

BaseDto constructor.

public __construct(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

getCompletionRequirement()

public getCompletionRequirement() : array<string, mixed>|null
Return values
array<string, mixed>|null

getIframe()

public getIframe() : array<string, int>|null
Return values
array<string, int>|null

setCompletionRequirement()

public setCompletionRequirement(array<string, mixed>|null $completionRequirement) : void
Parameters
$completionRequirement : array<string, mixed>|null

setContentId()

public setContentId(int|null $contentId) : void
Parameters
$contentId : int|null

setExternalUrl()

public setExternalUrl(string|null $externalUrl) : void
Parameters
$externalUrl : string|null
Tags
throws
InvalidArgumentException

If URL format is invalid

setIframe()

public setIframe(array<string, int>|null $iframe) : void
Parameters
$iframe : array<string, int>|null

setIndent()

public setIndent(int|null $indent) : void
Parameters
$indent : int|null

setNewTab()

public setNewTab(bool|null $newTab) : void
Parameters
$newTab : bool|null

setPageUrl()

public setPageUrl(string|null $pageUrl) : void
Parameters
$pageUrl : string|null

setPosition()

public setPosition(int|null $position) : void
Parameters
$position : int|null

setTitle()

public setTitle(string|null $title) : void
Parameters
$title : string|null

setType()

public setType(string|null $type) : void
Parameters
$type : string|null
Tags
throws
InvalidArgumentException

If module item type is invalid

toApiArray()

Convert the DTO to an array for API requests Handles nested arrays for iframe and completion_requirement

public toApiArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toArray()

Convert the DTO to an array

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results