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 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Contains class content_item_repository, for fetching content_items.

Copyright: 2020 Jake Dallimore <jrhdallimore@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 350 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: content_item_readonly_repository  - X-Ref

The class content_item_repository, for reading content_items.

get_core_module_help_string(string $modname)   X-Ref
Get the help string for content items representing core modules.

return: string the help string, including help link.
param: string $modname the module name.

content_item_from_legacy_data(\stdClass $item)   X-Ref
Create a content_item object based on legacy data returned from the get_shortcuts hook implementations.

return: content_item a content item object.
param: \stdClass $item the stdClass of legacy data.

content_item_to_legacy_data(content_item $contentitem)   X-Ref
Create a stdClass type object based on a content_item instance.

return: \stdClass the legacy data.
param: content_item $contentitem

get_subplugin_course_content_items(string $parentpluginname, content_item $modulecontentitem,\stdClass $user)   X-Ref
Helper to get the contentitems from all subplugin hooks for a given module plugin.

return: array the array of content items.
param: string $parentpluginname the name of the module plugin to check subplugins for.
param: content_item $modulecontentitem the content item of the module plugin, to pass to the hooks.
param: \stdClass $user the user object to pass to subplugins.

get_subplugin_all_content_items(string $parentpluginname, content_item $modulecontentitem)   X-Ref
Get all the content items for a subplugin.

return: array
param: string $parentpluginname
param: content_item $modulecontentitem

legacy_item_inherit_missing(\stdClass $legacyitem, content_item $modulecontentitem)   X-Ref
Helper to make sure any legacy items have certain properties, which, if missing are inherited from the parent module item.

return: \stdClass the updated legacy item stdClass
param: \stdClass $legacyitem the legacy information, a stdClass coming from get_shortcuts() hook.
param: content_item $modulecontentitem The module's content item information, to inherit if needed.

find_all()   X-Ref
Find all the available content items, not restricted to course or user.

return: array the array of content items.

find_all_for_course(\stdClass $course, \stdClass $user)   X-Ref
Get the list of potential content items for the given course.

return: array the array of content_item objects
param: \stdClass $course the course
param: \stdClass $user the user, to pass to plugins implementing callbacks.