Hey everyone,
So I have a custom module to add a nice video gallery to a course. I have a db table for videos and videos have video descriptions.
I've got it working fine with descriptions being a text area, but now there is a use case to add links to the description so I understand this needs to change to an editor. Here is my current form definition for the editor:
$mform->addElement('editor', 'description', get_string('video_description','mod_ovivideogallery'));
$mform->setType('description', PARAM_RAW);
The problem is when I load up the edit form the description in the database doesn't show in the editor field. If I add something to the editor field and then save the form, it saves correctly in the database but again doesn't show when I go to edit the same video.
Here is my code for getting and setting the data:
$data = new stdClass();
$data = \mod_ovivideogallery\videos::get_video($videoId);
$data->tags = core_tag_tag::get_item_tags_array('mod_ovivideogallery','ovivideogallery_videos', $videoId);
$data->path = $description;
$thumbnailDraftId = file_get_submitted_draft_itemid('thumbnailfile');
file_prepare_draft_area($thumbnailDraftId, $systemcontext->id, 'mod_ovivideogallery', 'thumbnailfile', $data->id, array('maxfiles' => 1))
$mform->set_data($data);
Any idea why this is happening? Thanks