MDL-56919 boost: Render non-action menu items as disabled action links

This commit is contained in:
Jun Pataleta 2016-11-25 14:48:11 +08:00
parent 27a3843d05
commit 894b1825f6
2 changed files with 10 additions and 6 deletions

View File

@ -712,22 +712,25 @@ class core_renderer extends \core_renderer {
continue;
}
if ($menuitem->action) {
$text = $menuitem->text;
if ($menuitem->action instanceof action_link) {
$link = $menuitem->action;
} else {
$link = new action_link($menuitem->action, $menuitem->text, null, null, $menuitem->icon);
}
if ($indent) {
$link->add_class('m-l-1');
}
} else {
if ($onlytopleafnodes) {
$skipped = true;
continue;
}
$link = $menuitem->text;
$link = new action_link(new moodle_url('#'), $menuitem->text, null, ['disabled' => true], $menuitem->icon);
}
if ($indent) {
$link->add_class('m-l-1');
}
if (!empty($menuitem->classes)) {
$link->add_class(implode(" ", $menuitem->classes));
}
$menu->add_secondary_action($link);
$skipped = $skipped || $this->build_action_menu_from_navigation($menu, $menuitem, true);
}

View File

@ -10,7 +10,8 @@
margin-right: 0.5rem;
}
a:first-of-type > .icon {
a:first-of-type > .icon,
span:first-of-type > .icon {
margin-left: 0.5rem;
}