Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Class: core_external  - X-Ref

Web service related functions

format_string_parameters($stringparams)   X-Ref
Format the received string parameters to be sent to the core get_string() function.

param: array $stringparams
return: object|string

get_string_parameters()   X-Ref
Returns description of get_string parameters

return: external_function_parameters

get_string($stringid, $component = 'moodle', $lang = null, $stringparams = array()   X-Ref
Return a core get_string() call

param: string $identifier string identifier
param: string $component string component
param: array $stringparams the string params
return: string

get_string_returns()   X-Ref
Returns description of get_string() result value

return: \core_external\external_description

get_strings_parameters()   X-Ref
Returns description of get_string parameters

return: external_function_parameters

get_strings($strings)   X-Ref
Return multiple call to core get_string()

param: array $strings strings to translate
return: array

get_strings_returns()   X-Ref
Returns description of get_string() result value

return: \core_external\external_description

get_user_dates_parameters()   X-Ref
Returns description of get_user_dates parameters

return: external_function_parameters

get_user_dates($contextid, $contextlevel, $instanceid, $timestamps)   X-Ref
Format an array of timestamps.

param: int|null $contextid The contenxt id
param: string|null $contextlevel The context level
param: int|null $instanceid The instnace id for the context level
param: array $timestamps Timestamps to format
return: array

get_user_dates_returns()   X-Ref
Returns description of get_user_dates() result value

return: \core_external\external_description

get_component_strings_parameters()   X-Ref
Returns description of get_component_strings parameters

return: external_function_parameters

get_component_strings($component, $lang = null)   X-Ref
Return all lang strings of a component - call to core get_component_strings().

param: string $component component name
return: array

get_component_strings_returns()   X-Ref
Returns description of get_component_strings() result value

return: \core_external\external_description

get_fragment_parameters()   X-Ref
Returns description of get_fragment parameters

return: external_function_parameters

get_fragment($component, $callback, $contextid, $args = null)   X-Ref
Get a HTML fragment for inserting into something. Initial use is for inserting mforms into
a page using AJAX.
This web service is designed to be called only via AJAX and not directly.
Callbacks that are called by this web service are responsible for doing the appropriate security checks
to access the information returned. This only does minimal validation on the context.

param: string $component Name of the component.
param: string $callback Function callback name.
param: int $contextid Context ID this fragment is in.
param: array $args optional arguments for the callback.
return: array HTML and JavaScript fragments for insertion into stuff.

get_fragment_returns()   X-Ref
Returns description of get_fragment() result value

return: \core_external\external_description

update_inplace_editable_parameters()   X-Ref
Parameters for function update_inplace_editable()

return: external_function_parameters

update_inplace_editable($component, $itemtype, $itemid, $value)   X-Ref
Update any component's editable value assuming that component implements necessary callback

param: string $component
param: string $itemtype
param: string $itemid
param: string $value

update_inplace_editable_returns()   X-Ref
Return structure for update_inplace_editable()

return: \core_external\external_description

fetch_notifications_parameters()   X-Ref
Returns description of fetch_notifications() parameters.

return: external_function_parameters

fetch_notifications_returns()   X-Ref
Returns description of fetch_notifications() result value.

return: \core_external\external_description

fetch_notifications($contextid)   X-Ref
Returns the list of notifications against the current session.

return: array