mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-46022 custom_menu: add support for dividers
This commit is contained in:
parent
337075d17b
commit
328ef3df0e
@ -165,13 +165,15 @@ $string['configcronremotepassword'] = 'This means that the cron.php script canno
|
||||
http://site.example.com/admin/cron.php?password=opensesame
|
||||
</pre>If this is left empty, no password is required.';
|
||||
$string['configcurlcache'] = 'Time-to-live for cURL cache, in seconds.';
|
||||
$string['configcustommenuitems'] = 'You can configure a custom menu here to be shown by themes. Each line consists of some menu text, a link URL (optional), a tooltip title (optional) and a language code or comma-separated list of codes (optional, for displaying the line to users of the specified language only), separated by pipe characters. You can specify a structure using hyphens. For example:
|
||||
$string['configcustommenuitems'] = 'You can configure a custom menu here to be shown by themes. Each line consists of some menu text, a link URL (optional), a tooltip title (optional) and a language code or comma-separated list of codes (optional, for displaying the line to users of the specified language only), separated by pipe characters. You can specify a structure using hyphens, and dividers can be used by adding a line of one or more # characters where desired. For example:
|
||||
<pre>
|
||||
Moodle community|https://moodle.org
|
||||
-Moodle free support|https://moodle.org/support
|
||||
-###
|
||||
-Moodle development|https://moodle.org/development
|
||||
--Moodle Docs|http://docs.moodle.org|Moodle Docs
|
||||
--German Moodle Docs|http://docs.moodle.org/de|Documentation in German|de
|
||||
#####
|
||||
Moodle.com|http://moodle.com/
|
||||
</pre>';
|
||||
$string['configdbsessions'] = 'If enabled, this setting will use the database to store information about current sessions. Note that changing this setting now will log out all current users (including you). If you are using MySQL please make sure that \'max_allowed_packet\' in my.cnf (or my.ini) is at least 4M. Other session drivers can be configured directly in config.php, see config-dist.php for more information. This option disappears if you specify session driver in config.php file.';
|
||||
|
@ -3070,14 +3070,31 @@ EOD;
|
||||
$content .= html_writer::end_tag('div');
|
||||
$content .= html_writer::end_tag('li');
|
||||
} else {
|
||||
// The node doesn't have children so produce a final menuitem
|
||||
$content = html_writer::start_tag('li', array('class'=>'yui3-menuitem'));
|
||||
if ($menunode->get_url() !== null) {
|
||||
$url = $menunode->get_url();
|
||||
// The node doesn't have children so produce a final menuitem.
|
||||
// Also, if the node's text matches '####', add a class so we can treat it as a divider.
|
||||
$content = '';
|
||||
if (preg_match("/^#+$/", $menunode->get_text())) {
|
||||
|
||||
// This is a divider.
|
||||
$content = html_writer::start_tag('li', array('class' => 'yui3-menuitem divider'));
|
||||
} else {
|
||||
$url = '#';
|
||||
$content = html_writer::start_tag(
|
||||
'li',
|
||||
array(
|
||||
'class' => 'yui3-menuitem'
|
||||
)
|
||||
);
|
||||
if ($menunode->get_url() !== null) {
|
||||
$url = $menunode->get_url();
|
||||
} else {
|
||||
$url = '#';
|
||||
}
|
||||
$content .= html_writer::link(
|
||||
$url,
|
||||
$menunode->get_text(),
|
||||
array('class' => 'yui3-menuitem-content', 'title' => $menunode->get_title())
|
||||
);
|
||||
}
|
||||
$content .= html_writer::link($url, $menunode->get_text(), array('class'=>'yui3-menuitem-content', 'title'=>$menunode->get_title()));
|
||||
$content .= html_writer::end_tag('li');
|
||||
}
|
||||
// Return the sub menu
|
||||
|
@ -832,6 +832,26 @@ x#fitem_id_availabilityconditionsjson input[type=text] {
|
||||
#custommenu .yui3-menu .yui3-menu .yui3-menu-label {background-image:url([[pix:theme|vertical-menu-submenu-indicator]]); padding-right: 20px;}
|
||||
#custommenu .yui3-menu .yui3-menu .yui3-menu-label-menuvisible {background-image:url([[pix:theme|horizontal-menu-submenu-indicator]]);}
|
||||
|
||||
/**
|
||||
* Dividers.
|
||||
*/
|
||||
.yui3-menu.yui3-menu-horizontal .yui3-menuitem.divider {
|
||||
overflow: hidden;
|
||||
width: 0;
|
||||
height: 24px;
|
||||
border-left: 1px solid #ddd;
|
||||
}
|
||||
.yui3-menu .yui3-menu .yui3-menuitem.divider {
|
||||
width: auto;
|
||||
height: 0;
|
||||
margin: 4px 1px;
|
||||
border-left: 0px none;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.yui3-menu .yui3-menuitem.divider a {
|
||||
visibility: invisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Smart Select Element
|
||||
*/
|
||||
|
@ -270,4 +270,24 @@ div#dock {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dividers
|
||||
.nav {
|
||||
.divider {
|
||||
overflow: hidden;
|
||||
width: 0;
|
||||
height: 40px;
|
||||
border-left: 1px solid #e5e5e5;
|
||||
border-right: 1px solid #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
.divider {
|
||||
width: auto;
|
||||
height: 1px;
|
||||
border-left: 0px none;
|
||||
border-right: 0px none;
|
||||
}
|
||||
}
|
@ -133,6 +133,7 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
|
||||
protected function render_custom_menu_item(custom_menu_item $menunode, $level = 0 ) {
|
||||
static $submenucount = 0;
|
||||
|
||||
$content = '';
|
||||
if ($menunode->has_children()) {
|
||||
|
||||
if ($level == 1) {
|
||||
@ -164,14 +165,21 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
|
||||
}
|
||||
$content .= '</ul>';
|
||||
} else {
|
||||
$content = '<li>';
|
||||
// The node doesn't have children so produce a final menuitem.
|
||||
if ($menunode->get_url() !== null) {
|
||||
$url = $menunode->get_url();
|
||||
// Also, if the node's text matches '####', add a class so we can treat it as a divider.
|
||||
if (preg_match("/^#+$/", $menunode->get_text())) {
|
||||
// This is a divider.
|
||||
$content = '<li class="divider"> </li>';
|
||||
} else {
|
||||
$url = '#';
|
||||
$content = '<li>';
|
||||
if ($menunode->get_url() !== null) {
|
||||
$url = $menunode->get_url();
|
||||
} else {
|
||||
$url = '#';
|
||||
}
|
||||
$content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
|
||||
$content .= '</li>';
|
||||
}
|
||||
$content .= html_writer::link($url, $menunode->get_text(), array('title'=>$menunode->get_title()));
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user