From 19fbc6175614954d522f90e90d7fcf8c4289aded Mon Sep 17 00:00:00 2001 From: mudrd8mz Date: Tue, 4 Aug 2009 19:35:00 +0000 Subject: [PATCH] NOBUG: fixing and documenting file_postupdate_standard_editor() Fixed a hardcoded name of the field to hold the trust info (the previous name comes from the glossary module). Added some documentation based on my experiences. --- lib/filelib.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/filelib.php b/lib/filelib.php index cecdb733ed..9bd37022b7 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -211,11 +211,19 @@ function file_prepare_standard_editor($data, $field, array $options, $context=nu } /** - * Prepares editing with File manager formslib element + * Prepares the content of the 'editor' form element with embeded media files to be saved in database * - * @param object $data $database entry field - * @param string $field name of data field - * @param array $options various options + * This function moves files from draft area to the destination area and + * encodes URLs to the draft files so they can be safely saved into DB. The + * form has to contain the 'editor' element named foobar_editor, where 'foobar' + * is the name of the database field to hold the wysiwyg editor content. The + * editor data comes as an array with text, format and itemid properties. This + * function automatically adds $data properties foobar, foobarformat and + * foobartrust, where foobar has URL to embeded files encoded. + * + * @param object $data raw data submitted by the form + * @param string $field name of the database field containing the html with embeded media files + * @param array $options editor options (trusttext, subdirs, maxfiles, maxbytes etc.) * @param object $context context, required for existing data * @param string $filearea file area name * @param int $itemid item id, required if item exists @@ -240,9 +248,9 @@ function file_postupdate_standard_editor($data, $field, array $options, $context } if ($options['trusttext']) { - $data->definitiontrust = trusttext_trusted($context); + $data->{$field.'trust'} = trusttext_trusted($context); } else { - $data->definitiontrust = 0; + $data->{$field.'trust'} = 0; } $editor = $data->{$field.'_editor'}; -- 2.39.5