diff --git a/mod/url/lang/en/url.php b/mod/url/lang/en/url.php index 15ac7e07a54..a8ca6fb0ea2 100644 --- a/mod/url/lang/en/url.php +++ b/mod/url/lang/en/url.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['clicktoopen'] = 'Click {$a} link to open resource.'; +$string['clicktoopen'] = 'Click on {$a} to open the resource.'; $string['configdisplayoptions'] = 'Select all options that should be available, existing settings are not modified. Hold CTRL key to select multiple fields.'; $string['configframesize'] = 'When a web page or an uploaded file is displayed within a frame, this value is the height (in pixels) of the top frame (which contains the navigation).'; $string['configrolesinparams'] = 'Should customised role names (from the course settings) be available as variables for URL parameters?'; @@ -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/locallib.php b/mod/url/locallib.php index b3998efae91..02ac7568eba 100644 --- a/mod/url/locallib.php +++ b/mod/url/locallib.php @@ -277,7 +277,7 @@ function url_print_workaround($url, $cm, $course) { } echo '
'; - print_string('clicktoopen', 'url', "$fullurl"); + print_string('clicktoopen', 'url', html_writer::link($fullurl, format_string($cm->name))); echo '
'; echo $OUTPUT->footer(); @@ -289,7 +289,6 @@ function url_print_workaround($url, $cm, $course) { * @param object $url * @param object $cm * @param object $course - * @return does not return */ function url_display_embed($url, $cm, $course) { global $PAGE, $OUTPUT; @@ -298,7 +297,7 @@ function url_display_embed($url, $cm, $course) { $fullurl = url_get_full_url($url, $cm, $course); $title = $url->name; - $link = html_writer::tag('a', $fullurl, array('href'=>str_replace('&', '&', $fullurl))); + $link = html_writer::link($fullurl, format_string($cm->name)); $clicktoopen = get_string('clicktoopen', 'url', $link); $moodleurl = new moodle_url($fullurl); 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 { diff --git a/mod/url/tests/behat/url_activity_completion.feature b/mod/url/tests/behat/url_activity_completion.feature index b2da6473ff3..f87c4c816b5 100644 --- a/mod/url/tests/behat/url_activity_completion.feature +++ b/mod/url/tests/behat/url_activity_completion.feature @@ -31,7 +31,9 @@ Feature: View activity completion information in the URL resource | completionview | 1 | | display | 0 | When I am on the "Music history" "url activity" page logged in as teacher1 - Then "Music history" should have the "View" completion condition + Then "Music history" "link" should exist + And I should see "Click on Music history to open the resource." + And "Music history" should have the "View" completion condition Scenario: View automatic completion items in automatic display mode as student Given the following "activity" exists: