From c80f562a4c7fd295df05bf9e81d97939826c7f7a Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Mon, 29 Nov 2021 11:18:51 +0800 Subject: [PATCH] MDL-70274 core: fix Validate HTML and WCAG Check links --- lang/en/moodle.php | 2 ++ lib/outputrenderers.php | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 3e36f4f3039..2f1bc963738 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -2200,6 +2200,7 @@ $string['useruploadtype'] = 'User upload type: {$a}'; $string['userzones'] = 'User zones'; $string['usetheme'] = 'Use theme'; $string['usingexistingcourse'] = 'Using existing course'; +$string['validatehtml'] = 'Validate HTML'; $string['valuealreadyused'] = 'This value has already been used.'; $string['version'] = 'Version'; $string['view'] = 'View'; @@ -2215,6 +2216,7 @@ $string['viewsolution'] = 'view solution'; $string['visible'] = 'Visible'; $string['visible_help'] = 'This setting determines whether the course appears in the list of courses. Apart from teachers and administrators, users are not allowed to enter the course.'; $string['visibletostudents'] = 'Visible to {$a}'; +$string['wcagcheck'] = 'Web Content Accessibility Guidelines (WCAG) check'; $string['warning'] = 'Warning'; $string['warningdeleteresource'] = 'Warning: {$a} is referred in a resource. Would you like to update the resource?'; $string['webpage'] = 'Web page'; diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 00e51a0da03..3a89521d699 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -872,13 +872,15 @@ class core_renderer extends renderer_base { html_writer::link($purgeurl, get_string('purgecaches', 'admin')) . ''; } if (!empty($CFG->debugvalidators)) { - // NOTE: this is not a nice hack, $this->page->url is not always accurate and - // $FULLME neither, it is not a bug if it fails. --skodak. - $output .= '
'; + $siteurl = qualified_me(); + $nuurl = new moodle_url('https://validator.w3.org/nu/', ['doc' => $siteurl, 'showsource' => 'yes']); + $waveurl = new moodle_url('https://wave.webaim.org/report#/' . urlencode($siteurl)); + $validatorlinks = [ + html_writer::link($nuurl, get_string('validatehtml')), + html_writer::link($waveurl, get_string('wcagcheck')) + ]; + $validatorlinkslist = html_writer::alist($validatorlinks, ['class' => 'list-unstyled ml-1']); + $output .= html_writer::div($validatorlinkslist, 'validators'); } return $output; }