MDL-69588 navigation: Show home primary node when required

This commit is contained in:
Mathew May 2021-08-09 15:20:48 +08:00
parent eed2498215
commit 1ce2bb0007
2 changed files with 6 additions and 4 deletions

View File

@ -35,8 +35,10 @@ class primary extends view {
return;
}
$this->id = 'primary_navigation';
$this->add(get_string('home'), new \moodle_url('/'), self::TYPE_SYSTEM,
if (get_home_page() == HOMEPAGE_SITE && isloggedin() && !isguestuser()) {
$this->add(get_string('home'), new \moodle_url('/'), self::TYPE_SYSTEM,
null, 'home', new \pix_icon('i/home', ''));
}
// Add the dashboard link.
if (isloggedin() && !isguestuser()) { // Makes no sense if you aren't logged in.

View File

@ -58,9 +58,9 @@ class primary_test extends \advanced_testcase {
*/
public function test_setting_initialise_provider() {
return [
'Testing as a guest user' => ['guest', ['home', 'courses']],
'Testing as an admin' => ['admin', ['home', 'myhome', 'courses', 'siteadminnode']],
'Testing as a regular user' => ['user', ['home', 'myhome', 'courses']]
'Testing as a guest user' => ['guest', ['courses']],
'Testing as an admin' => ['admin', ['myhome', 'courses', 'siteadminnode']],
'Testing as a regular user' => ['user', ['myhome', 'courses']]
];
}
}