mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-70476' of https://github.com/timhunt/moodle
This commit is contained in:
commit
c59c8e79ec
@ -72,6 +72,11 @@ class mustache_pix_helper {
|
||||
$text = strtok("");
|
||||
// Allow mustache tags in the last argument.
|
||||
$text = trim($helper->render($text));
|
||||
// The $text has come from a template, so HTML special
|
||||
// chars have been escaped. However, render_pix_icon
|
||||
// assumes the alt arrives with no escaping. So we need
|
||||
// ot un-escape here.
|
||||
$text = htmlspecialchars_decode($text);
|
||||
|
||||
return trim($this->renderer->pix_icon($key, $text, $component));
|
||||
}
|
||||
|
@ -30,24 +30,29 @@
|
||||
* rolename Name of the role rendered - must have been prepared for output with format_string,
|
||||
or more likely one of the role API functions like role_fix_names.
|
||||
* roleid Id of the role
|
||||
* action WEhich action is done on click
|
||||
* action Which action is done on click
|
||||
* spanclass class attribute of span
|
||||
* linkclass class attribute of link
|
||||
* adminurl moodle admin url
|
||||
* imageurl moodle url for delete(x) image
|
||||
* icon moodle icon for delete(x)
|
||||
* iconalt alt text for the icon. Must have been HTML escaped.
|
||||
|
||||
Example context (json):
|
||||
{"rolename" : "Manager",
|
||||
"roleid" : 1,
|
||||
"action": "prevent",
|
||||
"spanclass": "allowed",
|
||||
"linkclass": "preventlink",
|
||||
"adminurl" : "http://localhost/moodle/admin/"}
|
||||
{
|
||||
"rolename": "Manager",
|
||||
"roleid": 1,
|
||||
"action": "prevent",
|
||||
"spanclass": "allowed",
|
||||
"linkclass": "preventlink",
|
||||
"adminurl": "http://localhost/moodle/admin/",
|
||||
"icon": "t/delete",
|
||||
"iconalt": "Delete Student role"
|
||||
}
|
||||
}}
|
||||
<span style="display:inline-block;" class="{{spanclass}}"> {{{rolename}}}
|
||||
<a href="{{adminurl}}roles/permissions.php" class="{{linkclass}}" data-role-id="{{roleid}}" data-action="{{action}}">
|
||||
{{#icon}}
|
||||
{{#pix}}{{icon}}, core, {{iconalt}}{{/pix}}
|
||||
{{#pix}}{{icon}}, core, {{{iconalt}}}{{/pix}}
|
||||
{{/icon}}
|
||||
</a>
|
||||
</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user