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);
}
}
* @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);
}
* webservice->get_external_functions now returns the external function list ordered by name ASC.
* The filearea optional parameter has been removed from webservice/upload.php.
Since Moodle 3.1 all the uploads go to the draft area.
+* 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 ===