Contextheader - Display Home instead of Site Name

Contextheader - Display Home instead of Site Name

by Luke Bateson -
Number of replies: 1

Hi all

Moodle Version: 3.9

Journeying into the art of theme creation for an internal project, so far have been successful and have got some custom renderers going and got a bootstrap 4 theme working with the mustache templating system. I've ran into a problem though I can't get my head around.

output.full_header - delving down, the title is provided by the function "context_header". If there is no context_header set, it displays the full site name instead. One of the pages where this is the case is the "homepage". I'd like it to display "Home" rather than the site name, so there are two solutions

  • How can I stop it displaying the site name and instead display "Home"
  • Is there a function which can check "if page = homepage" as I could then do some custom stuff in the templating instead

Thanks in advance for help!


Average of ratings: -
In reply to Luke Bateson

Re: Contextheader - Display Home instead of Site Name

by Hugo Ribeiro -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Luke,

I'm on the same track as you and trying to learn a bunch of things, namely overriding renderers. Right now I'm trying to output some info only in the course main page. No success so far...

Please take my information with a grain of salt because I'm (really) not sure about this, but It seems to me this is still valid info: https://moodle.org/mod/forum/discuss.php?d=324948

So I guess you could use:
if ($PAGE->pagetype == 'site-index') {
// frontpage
}

But please test it and, if possible, wait for some more experienced user, which clearly is not me.