Skip to content

Commit

Permalink
MDL-76123 course: multilingual module icon alt text attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Aug 8, 2023
1 parent 6145630 commit 75de570
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 2 additions & 4 deletions course/format/classes/output/local/content/cm/cmname.php
Expand Up @@ -110,14 +110,12 @@ public function export_for_template(\renderer_base $output): array {
'iconclass' => $iconclass,
'modname' => $mod->modname,
'textclasses' => $displayoptions['textclasses'] ?? '',
'pluginname' => get_string('pluginname', 'mod_' . $mod->modname),
'showpluginname' => $this->format->show_editor(),
'purpose' => plugin_supports('mod', $mod->modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER),
'activityname' => $this->get_title_data($output),
];

if ($this->format->show_editor()) {
$data['pluginname'] = get_string('pluginname', 'mod_' . $mod->modname);
}

return $data;
}

Expand Down
9 changes: 6 additions & 3 deletions course/format/templates/local/content/cm/cmname.mustache
Expand Up @@ -27,6 +27,7 @@
"icon": "../../../pix/help.svg",
"iconclass": "",
"pluginname": "File",
"showpluginname": 1,
"textclasses": "",
"purpose": "content",
"modname": "resource",
Expand All @@ -48,14 +49,16 @@
<div class="activity-instance d-flex flex-column">
<div class="activitytitle media {{textclasses}} modtype_{{modname}} position-relative align-self-start">
<div class="activityiconcontainer {{purpose}} courseicon align-self-start mr-3">
<img src="{{{icon}}}" class="activityicon {{iconclass}}" alt="{{{modname}}} icon">
<img src="{{{icon}}}" class="activityicon {{iconclass}}"
alt="{{#cleanstr}} activityicon, moodle, {{{pluginname}}} {{/cleanstr}}"
>
</div>
<div class="media-body align-self-center">
{{#pluginname}}
{{#showpluginname}}
<div class="text-uppercase small">
{{{pluginname}}}
</div>
{{/pluginname}}
{{/showpluginname}}
<div class="activityname">
{{#activityname}}
{{$ core/inplace_editable }}
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Expand Up @@ -34,6 +34,7 @@
$string['activities_help'] = 'Activities, such as forums, quizzes and wikis, enable interactive content to be added to the course.';
$string['activity'] = 'Activity';
$string['activityclipboard'] = 'Moving this activity: {$a}';
$string['activityicon'] = '{$a} icon';
$string['activityiscurrentlyhidden'] = 'Sorry, this activity is currently hidden';
$string['activityheader'] = 'Activity menu';
$string['activitymodule'] = 'Activity module';
Expand Down

0 comments on commit 75de570

Please sign in to comment.