HFP-2329 Skip emty metadata fields for h5p.json
parent
82b50fc2f1
commit
f661248b5a
|
@ -1647,7 +1647,7 @@ Class H5PExport {
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach(array('authors', 'source', 'license', 'licenseVersion', 'licenseExtras' ,'yearFrom', 'yearTo', 'changes', 'authorComments') as $field) {
|
foreach(array('authors', 'source', 'license', 'licenseVersion', 'licenseExtras' ,'yearFrom', 'yearTo', 'changes', 'authorComments') as $field) {
|
||||||
if (isset($content['metadata'][$field])) {
|
if (isset($content['metadata'][$field]) && $content['metadata'][$field] !== '') {
|
||||||
if (($field !== 'authors' && $field !== 'changes') || (count($content['metadata'][$field]) > 0)) {
|
if (($field !== 'authors' && $field !== 'changes') || (count($content['metadata'][$field]) > 0)) {
|
||||||
$h5pJson[$field] = json_decode(json_encode($content['metadata'][$field], TRUE));
|
$h5pJson[$field] = json_decode(json_encode($content['metadata'][$field], TRUE));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue