MDL-54629 webservice: Change required parameters in external_format_text

component, filearea and itemid are now optional parameters.
In some contexts those parameteres are not necessary because is not
required to do a file rewrite via file_rewrite_pluginfile_urls
This commit is contained in:
Juan Leyva 2016-06-20 16:25:35 +01:00
parent 49619ce243
commit 833be5e410
3 changed files with 11 additions and 3 deletions

View File

@ -2722,7 +2722,7 @@ class calendar_event {
if ($this->properties->eventtype != 'user' && $this->properties->eventtype != 'course'
&& $this->properties->eventtype != 'site' && $this->properties->eventtype != 'group') {
// We don't have a context here, do a normal format_text.
return array(format_text($this->properties->description, $this->properties->format), $this->properties->format);
return external_format_text($this->properties->description, $this->properties->format, $this->editorcontext->id);
}
}

View File

@ -915,14 +915,16 @@ function external_format_string($str, $contextid, $striplinks = true, $options =
* @param object/array $options text formatting options
* @return array text + textformat
* @since Moodle 2.3
* @since Moodle 3.2 component, filearea and itemid are optional parameters
*/
function external_format_text($text, $textformat, $contextid, $component, $filearea, $itemid, $options = null) {
function external_format_text($text, $textformat, $contextid, $component = null, $filearea = null, $itemid = null,
$options = null) {
global $CFG;
// Get settings (singleton).
$settings = external_settings::get_instance();
if ($settings->get_fileurl()) {
if ($component and $filearea and $settings->get_fileurl()) {
require_once($CFG->libdir . "/filelib.php");
$text = file_rewrite_pluginfile_urls($text, $settings->get_file(), $contextid, $component, $filearea, $itemid);
}

View File

@ -3,6 +3,12 @@ information provided here is intended especially for developers.
This information is intended for authors of webservices, not people writing webservice clients.
=== 3.2 ===
* external_format_text function: component, filearea and itemid are now optional parameters.
In some contexts those parameteres are not necessary because is not required to do a file rewrite via
file_rewrite_pluginfile_urls.
=== 3.1 ===
* The xmlrpc backend has changed, Zend_XmlRpc has been dropped and there might be slight differences in