Merge branch 'MDL-76508-401' of https://github.com/meirzamoodle/moodle into MOODLE_401_STABLE
This commit is contained in:
Vendored
+1
-1
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;
|
||||
|
||||
Reference in New Issue
Block a user