validateGroup must handle isSubContent
* Update validateGroup in h4p.classes.php to allow subContentId into the data * Fix h5p-content-upgrade-process.js to take into account isSubContent Relates to: #HFP-285pull/27/head
parent
0882879552
commit
5494443533
|
@ -3056,7 +3056,9 @@ class H5PContentValidator {
|
||||||
$function = null;
|
$function = null;
|
||||||
$field = null;
|
$field = null;
|
||||||
|
|
||||||
if (count($semantics->fields) == 1 && $flatten) {
|
$isSubContent = isset($semantics->isSubContent) && $semantics->isSubContent === TRUE;
|
||||||
|
|
||||||
|
if (count($semantics->fields) == 1 && $flatten && !$isSubContent) {
|
||||||
$field = $semantics->fields[0];
|
$field = $semantics->fields[0];
|
||||||
$function = $this->typeMap[$field->type];
|
$function = $this->typeMap[$field->type];
|
||||||
$this->$function($group, $field);
|
$this->$function($group, $field);
|
||||||
|
@ -3064,7 +3066,7 @@ class H5PContentValidator {
|
||||||
else {
|
else {
|
||||||
foreach ($group as $key => &$value) {
|
foreach ($group as $key => &$value) {
|
||||||
// If subContentId is set, keep value
|
// If subContentId is set, keep value
|
||||||
if($key == 'subContentId' && $value == TRUE){
|
if($isSubContent && ($key == 'subContentId')){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ H5P.ContentUpgradeProcess = (function (Version) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'group':
|
case 'group':
|
||||||
if (field.fields.length === 1) {
|
if (field.fields.length === 1 && field.isSubContent !== true) {
|
||||||
// Single field to process, wrapper will be skipped
|
// Single field to process, wrapper will be skipped
|
||||||
self.processField(field.fields[0], params, function (err, upgradedParams) {
|
self.processField(field.fields[0], params, function (err, upgradedParams) {
|
||||||
if (upgradedParams) {
|
if (upgradedParams) {
|
||||||
|
|
Loading…
Reference in New Issue