MDL-67970 course: More informative aria-label for 'more help'

This commit is contained in:
Shamim Rezaie 2020-02-28 16:31:12 +11:00
parent 99cac46162
commit f064e11579
3 changed files with 8 additions and 6 deletions

View file

@ -53,7 +53,9 @@ class content_item_readonly_repository implements content_item_readonly_reposito
if ($sm->string_exists('modulename_link', $modname)) { // Link to further info in Moodle docs.
$link = get_string('modulename_link', $modname);
$linktext = get_string('morehelp');
$help .= \html_writer::tag('div', $OUTPUT->doc_link($link, $linktext, true), ['class' => 'helpdoclink']);
$arialabel = get_string('morehelpaboutmodule', '', get_string('modulename', $modname));
$doclink = $OUTPUT->doc_link($link, $linktext, true, ['aria-label' => $arialabel]);
$help .= \html_writer::tag('div', $doclink, ['class' => 'helpdoclink']);
}
}
return $help;

View file

@ -1291,6 +1291,7 @@ $string['moodleversion'] = 'Moodle version';
$string['moodlerelease'] = 'Moodle release';
$string['more'] = 'more';
$string['morehelp'] = 'More help';
$string['morehelpaboutmodule'] = 'More help about the {$a} module';
$string['moreinfo'] = 'More info';
$string['moreinformation'] = 'More information about this error';
$string['moreprofileinfoneeded'] = 'Please tell us more about yourself';

View file

@ -2135,16 +2135,15 @@ class core_renderer extends renderer_base {
* @param string $path The page link after doc root and language, no leading slash.
* @param string $text The text to be displayed for the link
* @param boolean $forcepopup Whether to force a popup regardless of the value of $CFG->doctonewwindow
* @param array $attributes htm attributes
* @return string
*/
public function doc_link($path, $text = '', $forcepopup = false) {
public function doc_link($path, $text = '', $forcepopup = false, array $attributes = []) {
global $CFG;
$icon = $this->pix_icon('docs', '', 'moodle', array('class'=>'iconhelp icon-pre', 'role'=>'presentation'));
$url = new moodle_url(get_docs_url($path));
$attributes = array('href'=>$url);
$attributes['href'] = new moodle_url(get_docs_url($path));
if (!empty($CFG->doctonewwindow) || $forcepopup) {
$attributes['class'] = 'helplinkpopup';
}
@ -2161,7 +2160,7 @@ class core_renderer extends renderer_base {
* @param string $pix short pix name
* @param string $alt mandatory alt attribute
* @param string $component standard compoennt name like 'moodle', 'mod_forum', etc.
* @param array $attributes htm lattributes
* @param array $attributes htm attributes
* @return string HTML fragment
*/
public function image_icon($pix, $alt, $component='moodle', array $attributes = null) {