MDL-74129 h5p: Preserve metadata information
The metadata information was not restored when an H5P file was uploaded (it was saved when it was edited directly from the Content bank, but the original information in the H5P file was lost). This patch includes all the metadata fields and its values in the original H5P file to preserve this information too.
This commit is contained in:
@@ -907,6 +907,13 @@ class framework implements H5PFrameworkInterface {
|
||||
$params->title = $content['title'];
|
||||
$content['params'] = json_encode($params);
|
||||
}
|
||||
// Add metadata to 'params'.
|
||||
if (!empty($content['metadata'])) {
|
||||
$params = json_decode($content['params']);
|
||||
$params->metadata = $content['metadata'];
|
||||
$content['params'] = json_encode($params);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'jsoncontent' => $content['params'],
|
||||
'displayoptions' => $content['disable'],
|
||||
|
||||
Reference in New Issue
Block a user