* @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<br>
*/
if ($text) {
$htmltext = $text.' ';
if ($accesshide) {
- $htmltext = '<span class="accesshide">'.$htmltext.'</span>';
+ $htmltext = get_accesshide($htmltext);
}
}
if ($url) {
if ($text) {
$htmltext = ' '.$text;
if ($accesshide) {
- $htmltext = '<span class="accesshide">'.$htmltext.'</span>';
+ $htmltext = get_accesshide($htmltext);
}
}
if ($url) {
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</$elem>";
+}
+
/**
* Return the breadcrumb trail navigation separator.
* @return string HTML string.
}
//Accessibility: breadcrumb links now in a list, » replaced with a 'silent' character.
- $nav_text = get_string('youarehere','access');
- $output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n";
+ $output .= get_accesshide(get_string('youarehere','access'), 'h2')."<ul>\n";
$output .= '<li class="first">'."\n".'<a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
.$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))
else {
$skip_text = get_string('skipa', 'access', strip_tags($title));
}
- $skip_link = '<a href="#sb-'.$block_id.'" class="skip-block" title="'.$skip_text.'">'."\n".'<span class="accesshide">'.$skip_text.'</span>'."\n".'</a>';
+ $skip_link = '<a href="#sb-'.$block_id.'" class="skip-block" title="'.$skip_text.'">'."\n".get_accesshide($skip_text)."\n".'</a>';
$skip_dest = '<span id="sb-'.$block_id.'" class="skip-block-to"></span>';
if (! empty($heading)) {
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
-?>
+?>
\ No newline at end of file