Override Boost header.mustache and navbar.mustache in child

Override Boost header.mustache and navbar.mustache in child

by A W -
Number of replies: 5

Hi,

This may be an obvious thing I've overlooked.

I've made various changes to original Boost folder layout files in the process of developing/tweaking a child theme.

I'm now in the process of attempting to replicate all those changed mustache files in the new theme folder so it can just be deployed by copying on the new theme folder not the new theme and original Boost folder i.e. im going back and trying to move all my fiddling with say columns2.mustache,  header.mustache and navbar.mustache in the original Boost templates directory into the new child theme.

So in the case of columns2.mustache its OK, copy the altered columns2.mustache to new child theme templates folder. Copy columns2.php to new child theme layout folder, change ref in columns2.php to point to the new theme i.e. @template theme_XXXboost/columns2

However in terms of navbar.mustache and header.mustache which are in /templates/core can't seem to get it to work?

Taking say alteration of /core/navbar.mustache in the file I tried changing :

@template core/navbar

to

@template theme_xxxboost/core/navbar

but didn't work? Likewise with header.mustache.

Am I missing something obvious?

Any help much apprenticed,

Thanks,

Alex

Average of ratings: -
In reply to A W

Re: Override Boost header.mustache and navbar.mustache in child

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

You did not say which version of Moodle you are using, as most theme developers, including myself, are working with Moodle 3.3Dev.

However, I will assume that you are using Moodle 3.2.2 and Boost

If I am reading this correctly, it looks like you have made changes to the Boost theme and then after getting it to work the way you want it to, you have put everything back to its original state and then introduce a new child theme using the customised Boost theme files but under a new name  eg: xxxboost

If that is correct, then am I to assume that this new theme has been installed and has been verified by going to Site administration > Administration > Notifications ???

Thanks

Mary

In reply to A W

Re: Override Boost header.mustache and navbar.mustache in child

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Alex,

Following on from my last comment, I want to keep this next question separate as it not something that is clear from the Moodle docs on how to approach this.

With respect to

@template core/navbar

to

@template theme_xxxboost/core/navbar

I would suspect that what you need to do is make sure your child copy is using the same wording as the  parent file so that your child code overrides the core one.

If you are only changing the two you mentioned then keep the folders and files the same as the parent.

This is only sheer guesswork as I have not tested it out.

Hope this helps is someway?

Mary

Average of ratings: Useful (1)
In reply to A W

Re: Override Boost header.mustache and navbar.mustache in child

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

'@template' is within a comment so has no effect on the processing.  Must be something else.

'header' will be down to changing line 66 '{{>theme_boost/header}}' in columns2.mustache.  Also 'header.mustache' is in the 'templates' not the 'templates/core' folder.

In reply to A W

Re: Override Boost header.mustache and navbar.mustache in child

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Following on from what Gareth said about renaming there is also a reference that points to boost theme column2 template in the last line of the layout/column2.php

echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);

Cheers

Mary

In reply to Mary Evans

Re: Override Boost header.mustache and navbar.mustache in child

by A W -

Folks,

Many thanks for your suggestions, after some fiddling based on the suggestions I've managed to wrap it all into a single deployable folder which can be copied over with no alterations to the default boost theme required.

Thanks,

Alex