Skip to content
Snippets Groups Projects
Commit 749f60f2 authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Removed build_action_menu_from_navigation in core_renderer as MDL-58174 is integrated.

parent 8b1bf721
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@ moodle-theme_boost_campus
Changes
-------
### Unreleased
* 2018-04-25 - Removed build_action_menu_from_navigation in core_renderer as MDL-58174 is integrated.
### Release v3.4-r4
* 2018-03-02 - Removed introduced get_extra_scss callbak again due to doubled CSS code.
......
......@@ -435,60 +435,4 @@ class core_renderer extends \theme_boost\output\core_renderer {
return $this->render_from_template('core/loginform', $context);
ORIGINAL END. */
}
// TODO Remove the copied function build_action_menu_from_navigation in version 3.4 of the theme.
// This will be the first Moodle major version having MDL-58174 integrated from version x.0 on.
/**
* Take a node in the nav tree and make an action menu out of it.
* The links are injected in the action menu.
*
* @param action_menu $menu
* @param navigation_node $node
* @param boolean $indent
* @param boolean $onlytopleafnodes
* @return boolean nodesskipped - True if nodes were skipped in building the menu
*/
protected function build_action_menu_from_navigation(action_menu $menu,
navigation_node $node,
$indent = false,
$onlytopleafnodes = false) {
$skipped = false;
// Build an action menu based on the visible nodes from this navigation tree.
foreach ($node->children as $menuitem) {
if ($menuitem->display) {
if ($onlytopleafnodes && $menuitem->children->count()) {
$skipped = true;
continue;
}
if ($menuitem->action) {
if ($menuitem->action instanceof action_link) {
$link = $menuitem->action;
// Give preference to setting icon over action icon.
if (!empty($menuitem->icon)) {
$link->icon = $menuitem->icon;
}
} else {
$link = new action_link($menuitem->action, $menuitem->text, null, null, $menuitem->icon);
}
} else {
if ($onlytopleafnodes) {
$skipped = true;
continue;
}
$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);
}
}
return $skipped;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment