mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Merge branch 'MDL-76508-400' of https://github.com/meirzamoodle/moodle into MOODLE_400_STABLE
This commit is contained in:
commit
7d4104a8eb
3 changed files with 17 additions and 4 deletions
2
lib/amd/build/templates.min.js
vendored
2
lib/amd/build/templates.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -556,9 +556,22 @@ function(
|
||||||
// Allow variable expansion in the param part only.
|
// Allow variable expansion in the param part only.
|
||||||
param = helper(param, context);
|
param = helper(param, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow json formatted $a arguments.
|
// Allow json formatted $a arguments.
|
||||||
if ((param.indexOf('{') === 0) && (param.indexOf('{{') !== 0)) {
|
// Added double quote after left curly bracket to differentiate between string and JSON string.
|
||||||
param = JSON.parse(param);
|
if (param.indexOf('{"') === 0) {
|
||||||
|
// If it can't be parsed then the string is not a JSON format.
|
||||||
|
try {
|
||||||
|
const parsedParam = JSON.parse(param);
|
||||||
|
// Handle non-exception-throwing cases, e.g. null, integer, boolean.
|
||||||
|
if (parsedParam && typeof parsedParam === "object") {
|
||||||
|
param = parsedParam;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// This was probably not JSON.
|
||||||
|
// Keep the error message visible.
|
||||||
|
window.console.warn(err.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var index = this.requiredStrings.length;
|
var index = this.requiredStrings.length;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue