From 7ffbc234260b99c833b80a1d37483bddb1e3cdbf Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Wed, 21 Jun 2023 22:54:09 +0800 Subject: [PATCH] MDL-78542 mod_url: Add a help text for URL resource name field Add a help text explaining that the URL resource's name field will be used for the link text. Also add basic guidelines about naming links for the benefit of screen reader users. --- mod/url/lang/en/url.php | 6 ++++++ mod/url/mod_form.php | 1 + 2 files changed, 7 insertions(+) diff --git a/mod/url/lang/en/url.php b/mod/url/lang/en/url.php index 15ac7e07a54..dd2934ff37b 100644 --- a/mod/url/lang/en/url.php +++ b/mod/url/lang/en/url.php @@ -64,6 +64,12 @@ There are a number of display options for the URL, such as embedded or opening i Note that URLs can also be added to any other resource or activity type through the text editor.'; $string['modulename_link'] = 'mod/url/view'; $string['modulenameplural'] = 'URLs'; +$string['name'] = 'Name'; +$string['name_help'] = 'This will serve as the link text for the URL. + +Enter a meaningful text that concisely describes the URL\'s purpose. + +Avoid using the word "link". This will help screen reader users as screen readers announce links (e.g. "Moodle.org, link") so there\'s no need to include the word "link" in the name field.'; $string['page-mod-url-x'] = 'Any URL module page'; $string['parameterinfo'] = '&parameter=variable'; $string['parametersheader'] = 'URL variables'; diff --git a/mod/url/mod_form.php b/mod/url/mod_form.php index eb3d2d0a191..099b8978231 100644 --- a/mod/url/mod_form.php +++ b/mod/url/mod_form.php @@ -38,6 +38,7 @@ class mod_url_mod_form extends moodleform_mod { //------------------------------------------------------- $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'48')); + $mform->addHelpButton('name', 'name', 'url'); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else {