MDL-62345 navigation: Change data-key for dashboard rootnode

This commit is contained in:
Adrian Perez 2019-02-16 21:58:04 +01:00 committed by Adrian Perez
parent 07203d34f1
commit f286376913

View File

@ -1280,7 +1280,7 @@ class global_navigation extends navigation_node {
// The home element should be my moodle because the root element is the site
if (isloggedin() && !isguestuser()) { // Makes no sense if you aren't logged in
$this->rootnodes['home'] = $this->add(get_string('myhome'), new moodle_url('/my/'),
self::TYPE_SETTING, null, 'home', new pix_icon('i/dashboard', ''));
self::TYPE_SETTING, null, 'myhome', new pix_icon('i/dashboard', ''));
$this->rootnodes['home']->showinflatnavigation = true;
}
} else {
@ -1488,7 +1488,7 @@ class global_navigation extends navigation_node {
foreach ($this->rootnodes as $node) {
// Dont remove the home node
/** @var navigation_node $node */
if ($node->key !== 'home' && !$node->has_children() && !$node->isactive) {
if (!in_array($node->key, ['home', 'myhome']) && !$node->has_children() && !$node->isactive) {
$node->remove();
}
}