且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 MOODLE 2.9 中通过 tinymce 编辑器保存和显示上传的图像

更新时间:2023-02-08 20:03:02

要在编辑器中操作文件,您必须使用以下方法:

To manipulate files in an editor you must use the following methods:

  • 在显示表单之前:file_prepare_standard_editor()
  • 保存表单时:file_postupdate_standard_editor()
  • 显示内容时:file_rewrite_pluginfile_urls() 后跟format_text()

您可以在 cohort/edit.phpcohort/index.php 中找到此类示例.

You can find an example of this in cohort/edit.php and cohort/index.php.

完成后,您需要实现函数_pluginfile,Moodle 核心将调用该函数来获取文件._pluginfile 函数是必需的,以便您的插件可以检查用户是否可以访问该文件.您可以在 filelib.php file_pluginfile() 和各种 lib.php _pluginfile() 中找到默认实现.

Once that is done, you need to implement the function _pluginfile which Moodle core will call to get the file. The _pluginfile functions are required so that your plugin can check whether or not the user can access the file. You can find default implementations in filelib.php file_pluginfile() and in various lib.php <component_name>_pluginfile().