mirror of
https://github.com/moodle/moodle.git
synced 2025-03-22 00:20:37 +01:00
Merge branch 'MDL-76508-401' of https://github.com/meirzamoodle/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
b24414554f
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.
|
||||
param = helper(param, context);
|
||||
}
|
||||
|
||||
// Allow json formatted $a arguments.
|
||||
if ((param.indexOf('{') === 0) && (param.indexOf('{{') !== 0)) {
|
||||
param = JSON.parse(param);
|
||||
// Added double quote after left curly bracket to differentiate between string and JSON string.
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user