Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 138 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ContentItem:: (6 methods):
  __construct()
  setUrl()
  setMediaType()
  setTitle()
  setText()
  toJson()


Class: ContentItem  - X-Ref

Class to represent a content-item object

__construct($type, $placementAdvice = null, $id = null)   X-Ref
Class constructor.

param: string $type Class type of content-item
param: ContentItemPlacement $placementAdvice  Placement object for item (optional)
param: string $id   URL of content-item (optional)

setUrl($url)   X-Ref
Set a URL value for the content-item.

param: string $url  URL value

setMediaType($mediaType)   X-Ref
Set a media type value for the content-item.

param: string $mediaType  Media type value

setTitle($title)   X-Ref
Set a title value for the content-item.

param: string $title  Title value

setText($text)   X-Ref
Set a link text value for the content-item.

param: string $text  Link text value

toJson($items)   X-Ref
Wrap the content items to form a complete application/vnd.ims.lti.v1.contentitems+json media type instance.

param: mixed $items An array of content items or a single item
return: string