Long-term effect of theme changes

Long-term effect of theme changes

by Javier Cuadrado -
Number of replies: 2

Hello,

I have a question about the effect my modificiations can have in the long term (specifically when there are new moodle versions).

I am creating a new moodle footer, I have copied the footer.mustache into my theme and am ready to modify it.

However, I see that it has a lot of elements.

{{# output.page_doc_link }}
            <p class="helplink">{{{ output.page_doc_link }}}</p>
        {{/ output.page_doc_link }}
        {{{ output.login_info }}}
        <div class="tool_usertours-resettourcontainer"></div>
        {{{ output.home_link }}}
        <nav class="nav navbar-nav d-md-none" aria-label="{{#str}}custommenu, admin{{/str}}">
            {{# output.custom_menu_flat }}
                <ul class="list-unstyled pt-3">
                    {{> theme_boost/custom_menu_footer }}
                </ul>
            {{/ output.custom_menu_flat }}
        </nav>
        {{{ output.standard_footer_html }}}

My idea was to remove them, stay with just these, and add my own code inside:

<footer id="page-footer" class="py-3 bg-dark text-light">
    <div class="container">
    </div>
</footer>


1. Is this a good practice to proceed in theme customization? 

2. What effects can it have in the long term?

3. Is there anything I should know?


All advice is welcome ! 


ps: I just got into moodle programming a few weeks ago 


Average of ratings: -
In reply to Javier Cuadrado

Re: Long-term effect of theme changes

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Not all those items will always display, some depend on the settings you have. For example, Tours, you may not have that enabled.

If you're not using the Custom menu, then that won't display. However, it should be noted if you do use the custom menu, which usually displays in the top nav bar, when the page is viewed on a small screen, such as a phone, the menu drops to the bottom of the page. So if you removed it, you completely remove the menu for some users.

You wouldn't want to get rid of the output.standard_footer_html as that will include some things like javascript, so I think you'll completely bork your site if you did that.

Just to check, you're creating a child theme and not editing directly the Boost theme? If you're editing Boost, then yes you will have problems each time you update. Do check out the docs on creating themes: https://docs.moodle.org/dev/Creating_a_theme_based_on_boost

Also, with regards to mustache templates, you can override them in your theme. Just copy to your theme/yourtheme/templates directory see https://docs.moodle.org/dev/Templates#Overriding_templates_in_a_theme

Obviously, the more you change the more you have to maintain. It's a task I go through for every major point release.
Average of ratings: Useful (1)
In reply to Mark Sharp

Re: Long-term effect of theme changes

by Javier Cuadrado -
Hi Mark,

Thanks a lot for your answer.

I have made a copy in my child theme footer.mustache of Boost (thanks for the ressources ! )

I have decided to replace the code with this one, as not all the elements that come with boost footer.template would correspond to the ones requested in the spec.

However, saving custom_menu_flat() could be interesting as I have items added in the custom_menu of the nav_bar. However, when testing in the mobile version, no elements appear in the footer. Does it seem that they are different functions? (I have another ticket open on this issue)-

It's good to know that as long as I don't modify the boost_theme I won't have a problem with the updates.
Although I guess I won't be able to benefit from them if I have completely changed the template ? For example, with the accessibility improvements that will come with moodle version 4, would I need to retrieve the new boost template 4.0 again and modify it? (I don't know if my question is clear 😅)

<footer id="page-footer" class="py-3 text-white">
    <div class="container">
        <nav class="d-flex justify-content-center">
            <ul>
                <a href="https://docs.moodle.org/311/en/my/index"><i class="fa fa-users fa-2x"></i>{{#str}} about_us, theme_javier {{/str}}
</a>
            </ul>
            <ul>
                <a href="https://www.crp-epnak-foad.com/"><i class="fa fa-question-circle fa-2x"></i>{{#str}} faq, theme_javier{{/str}}</a>
            </ul>
            <ul>
                <a href="https://crp-epnak-pad.tech/"><i class="fa fa-envelope fa-2x"></i>{{#str}} contact_us, theme_javier {{/str}}</a>
            </ul>
            {{# output.custom_menu_flat }}
                <ul class="list-unstyled pt-3">
                    {{> theme_boost/custom_menu_footer }}
                </ul>
            {{/ output.custom_menu_flat }}
        </nav>
        {{{ output.standard_end_of_body_html }}}
    </div>
</footer>