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.

Contains the import_handler_registry class.

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

Defines 1 class


Class: import_handler_registry  - X-Ref

The import_handler_registry class.

The import_handler_registry objects represent a register of modules handling various file extensions for a given course and user.
Only modules which are available to the user in the course are included in the register for that user.

__construct(\stdClass $course, \stdClass $user)   X-Ref
The import_handler_registry constructor.

param: \stdClass $course the course, which impacts available handlers.
param: \stdClass $user the user, which impacts available handlers.

get_resource_handlers_for_strategy(remote_resource $resource, import_strategy $strategy)   X-Ref
Get all handlers for the remote resource, depending on the strategy being used to import the resource.

param: remote_resource $resource the remote resource.
param: import_strategy $strategy an import_strategy instance.
return: import_handler_info[] the array of import_handler_info handlers.

get_resource_handler_for_mod_and_strategy(remote_resource $resource, string $modname,import_strategy $strategy)   X-Ref
Get a specific handler for the resource, belonging to a specific module and for a specific strategy.

param: remote_resource $resource the remote resource.
param: string $modname the name of the module, e.g. 'label'.
param: import_strategy $strategy a string representing how to treat the resource. e.g. 'file', 'link'.
return: import_handler_info|null the import_handler_info object, if found, otherwise null.

populate_handlers()   X-Ref
Build up a list of extension handlers by leveraging the dndupload_register callbacks.


register_type_handler(string $identifier, string $module, string $message)   X-Ref
Adds a type handler to the list.

param: string $identifier the name of the type.
param: string $module the name of the module, e.g. 'label'.
param: string $message the message describing how the module handles the type.

register_file_handler(string $extension, string $module, string $message)   X-Ref
Adds a file extension handler to the list.

param: string $extension the extension, e.g. 'png'.
param: string $module the name of the module handling this extension
param: string $message the message describing how the module handles the extension.