Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 402] [Versions 400 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.

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