From: nfreear Date: Tue, 25 Sep 2007 11:33:30 +0000 (+0000) Subject: MDL-11436, Encapsulate "accesshide" HTML class in function. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1d75edd0ae1f16d546855ed16eb6bfbd0987d163;p=moodle.git MDL-11436, Encapsulate "accesshide" HTML class in function. --- diff --git a/lib/weblib.php b/lib/weblib.php index 5b0b530cd1..f0512e52ec 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1060,6 +1060,8 @@ function print_textfield ($name, $value, $alt = '',$size=50,$maxlength=0, $retur * @param boolean $return Indicates whether the function should return the text * as a string or echo it directly to the page being rendered * @param string $targetwindow The name of the target page to open the linked page in. + * @param string $selectlabel Text to place in a [label] element - preferred for accessibility. + * @param array $optionsextra TODO, an array? * @return string If $return is true then the entire form is returned as a string. * @todo Finish documenting this function
*/ @@ -3193,7 +3195,7 @@ function link_arrow_right($text, $url='', $accesshide=false, $addclass='') { if ($text) { $htmltext = $text.' '; if ($accesshide) { - $htmltext = ''.$htmltext.''; + $htmltext = get_accesshide($htmltext); } } if ($url) { @@ -3227,7 +3229,7 @@ function link_arrow_left($text, $url='', $accesshide=false, $addclass='') { if ($text) { $htmltext = ' '.$text; if ($accesshide) { - $htmltext = ''.$htmltext.''; + $htmltext = get_accesshide($htmltext); } } if ($url) { @@ -3240,6 +3242,19 @@ function link_arrow_left($text, $url='', $accesshide=false, $addclass='') { return $arrow.$htmltext; } +/** + * Return a HTML element with the class "accesshide", for accessibility. + * Please use cautiously - where possible, text should be visible! + * @param string $text Plain text. + * @param string $elem Lowercase element name, default "span". + * @param string $class Additional classes for the element. + * @param string $attrs Additional attributes string in the form, "name='value' name2='value2'" + * @return string HTML string. + */ +function get_accesshide($text, $elem='span', $class='', $attrs='') { + return "<$elem class=\"accesshide $class\" $attrs>$text"; +} + /** * Return the breadcrumb trail navigation separator. * @return string HTML string. @@ -3303,8 +3318,7 @@ function print_navigation ($navigation, $separator=0, $return=false) { } //Accessibility: breadcrumb links now in a list, » replaced with a 'silent' character. - $nav_text = get_string('youarehere','access'); - $output .= '

'.$nav_text."