From 03671ebbf899ad73e06d565aa582777c56f3a329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 29 May 2020 11:26:39 +0200 Subject: [PATCH] MOBILE-3438 question: ddmarker image background removed from js on 3.9 --- src/addon/qtype/ddmarker/component/ddmarker.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/addon/qtype/ddmarker/component/ddmarker.ts b/src/addon/qtype/ddmarker/component/ddmarker.ts index a7d30837c..1b0870b36 100644 --- a/src/addon/qtype/ddmarker/component/ddmarker.ts +++ b/src/addon/qtype/ddmarker/component/ddmarker.ts @@ -89,14 +89,20 @@ export class AddonQtypeDdMarkerComponent extends CoreQuestionBaseComponent imple } } else if (this.question.amdArgs) { // Moodle version >= 3.6. - if (typeof this.question.amdArgs[1] != 'undefined') { - this.imgSrc = this.question.amdArgs[1]; + let nextIndex = 1; + // Moodle version >= 3.9, imgSrc is not specified, do not advance index. + if (typeof this.question.amdArgs[nextIndex] != 'undefined' && typeof this.question.amdArgs[nextIndex] != 'boolean') { + this.imgSrc = this.question.amdArgs[nextIndex]; + nextIndex++; } - if (typeof this.question.amdArgs[2] != 'undefined') { - this.question.readOnly = this.question.amdArgs[2]; + + if (typeof this.question.amdArgs[nextIndex] != 'undefined') { + this.question.readOnly = this.question.amdArgs[nextIndex]; } - if (typeof this.question.amdArgs[3] != 'undefined') { - this.dropZones = this.question.amdArgs[3]; + nextIndex++; + + if (typeof this.question.amdArgs[nextIndex] != 'undefined') { + this.dropZones = this.question.amdArgs[nextIndex]; } }