There is a difference between how our PHP mustache engine and JS
mustache engine escaping works. If the icon key is not hard-coded in the
template but defined as a context variable, the JS mustache engine
escapes the forward slashes.
This is the same problem that we had in MDL-52486. When the language
pack with multiple underscores (such as "en_us_k12") is selected, the
html root element's "lang" attribute is set to
<html lang="en-us-12" ...>
which we then map back to the Moodle lang code using the JS function
replace().
What was missed in MDL-52486 was that when replacing a value (and not a
regular expression), only the first instance of the value is replaced.
So the value "en_us-k12" was sent as the lang parameter for the
core_string, which is invalid PARAM_LANG value and the exception was
thrown.
In case of the user_date.js, there was no actual problem experienced and
probably there is none as the language code is used as a cache key
rather than a PARAM_LANG parameter. But we are changing it too for
consistency.
This is yukky but it works. Note: I had to duplicate the standard pix icon template
inside the font-awesome one because the way this is rendered does not support partials.
There is an edge case where we do not wait for all promises before
rendering a template. This can generate "failed to pre-fetch the template" JS errors.
For font awesome icons I had only supported one of alt/title. This was because (subjectively) we have
done a terrible job of providing meaningful alt text for icons. This is not a good idea and not backwards
compatible so I have put it back again.
Fingers crossed I did not break 1000 behats.
Add a modal registry for the types and make the factory use it to allow
code to register modal types at run time and use the factory for
non-core modals.
Recursively pre-scan mustache templates to extract the list of blocks and partials. Then
we can pre-fetch them all and don't have to rely on jquery async ajax (which is deprecated).
This is part of a refactoring of the promises code in the templates module to prevent duplicate requests.
- No longer use the Fibonacci sequence for delaying the timeout.
It is too aggressive.
- The backoff_timer AMD module now expects the callback AND the
backoff function to be passed to the constructor.
- Added ability to specify polling frequency in config.php.
- Added helper function to return the cache key.
- Reworded the parameters for clarity.
Prior to the patch the strings wrapped as the following one
where not found and replaced when rendering the template via Javascript
{{#quote}}{{#str}}string,component{{/str}}{{/quote}}