MDL-36874 mod_book: Add uarrow() output renderer.

In preparation for Book navigation improvements in MDL-36874, this commit
adds a uarrow() output renderer, to complement rarrow() and larrow().
This commit is contained in:
David Balch
2014-10-28 09:29:28 +00:00
parent d63a81c507
commit 7b2eff2886
2 changed files with 33 additions and 6 deletions
+20 -6
View File
@@ -278,6 +278,15 @@ class theme_config {
*/
public $larrow = null;
/**
* @var string Accessibility: Up arrow-like character is used in
* the book heirarchical navigation.
* If the theme does not set characters, appropriate defaults
* are set automatically. Please DO NOT
* use ^ - this is confusing for blind users.
*/
public $uarrow = null;
/**
* @var bool Some themes may want to disable ajax course editing.
*/
@@ -452,11 +461,13 @@ class theme_config {
$baseconfig = $config;
}
$configurable = array('parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'javascripts', 'javascripts_footer',
'parents_exclude_javascripts', 'layouts', 'enable_dock', 'enablecourseajax', 'supportscssoptimisation',
'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'hidefromselector', 'doctype',
'yuicssmodules', 'blockrtlmanipulations', 'lessfile', 'extralesscallback', 'lessvariablescallback',
'blockrendermethod');
$configurable = array(
'parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets',
'javascripts', 'javascripts_footer', 'parents_exclude_javascripts',
'layouts', 'enable_dock', 'enablecourseajax', 'supportscssoptimisation',
'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'uarrow',
'hidefromselector', 'doctype', 'yuicssmodules', 'blockrtlmanipulations',
'lessfile', 'extralesscallback', 'lessvariablescallback', 'blockrendermethod');
foreach ($config as $key=>$value) {
if (in_array($key, $configurable)) {
@@ -533,7 +544,7 @@ class theme_config {
}
/**
* Checks if arrows $THEME->rarrow, $THEME->larrow have been set (theme/-/config.php).
* Checks if arrows $THEME->rarrow, $THEME->larrow, $THEME->uarrow have been set (theme/-/config.php).
* If not it applies sensible defaults.
*
* Accessibility: right and left arrow Unicode characters for breadcrumb, calendar,
@@ -546,6 +557,7 @@ class theme_config {
// Also OK in Win 9x/2K/IE 5.x
$this->rarrow = '►';
$this->larrow = '◄';
$this->uarrow = '▲';
if (empty($_SERVER['HTTP_USER_AGENT'])) {
$uagent = '';
} else {
@@ -564,6 +576,7 @@ class theme_config {
// So we use the same ones Konqueror uses.
$this->rarrow = '→';
$this->larrow = '←';
$this->uarrow = '↑';
}
elseif (isset($_SERVER['HTTP_ACCEPT_CHARSET'])
&& false === stripos($_SERVER['HTTP_ACCEPT_CHARSET'], 'utf-8')) {
@@ -571,6 +584,7 @@ class theme_config {
// To be safe, non-Unicode browsers!
$this->rarrow = '>';
$this->larrow = '<';
$this->uarrow = '^';
}
// RTL support - in RTL languages, swap r and l arrows
+13
View File
@@ -3189,6 +3189,19 @@ EOD;
return $this->page->theme->larrow;
}
/**
* Accessibility: Up arrow-like character is used in
* the book heirarchical navigation.
* If the theme does not set characters, appropriate defaults
* are set automatically. Please DO NOT
* use ^ - this is confusing for blind users.
*
* @return string
*/
public function uarrow() {
return $this->page->theme->uarrow;
}
/**
* Returns the custom menu if one has been set
*