Search code examples
moodlemoodle-theme

How can I find and edit the html code for Moodle without using the additional HTML box?


I've been hunting for days now and for whatever reason the code seems to be pretty elusive with files linking to files that link to other files that don't exist. So can anyone tell me where i can find the HTML / PHP / SQL code, or whatever it may be, that is used to piece together the course?

The section im trying to edit is this red block:

this red block

Looking at the browser developer tools the div is called page-header. But more realistically it could be called something completely different in the madness that pieces it all together.

After some digging i came across drawers.mustche in boost / templates / and on line 129 it says {{{ output.full.header}}}

{{{ output.full.header}}}

but i get lost from there because there doesn't seem to be any file that remotely references the full header.


Solution

  • In moodle, you can use the theme plugin renderers to render the core outputs. Please refer to the theme renderer method.
    https://docs.moodle.org/dev/Overriding_a_renderer

    you can find the full_header function in lib\outputrenderers.php Line no 4340. Html content of the full header loaded from lib\templates\full_header.mustache

    You can override the full_header HTML content using the currently running theme. The following steps will help you to change the full header.

    1. Create the folder "core" in the current running theme "templates" folder. i.e theme\boost\templates\core

    2. Copy the full_header.mustache from the lib\templates folder to the newly created theme\template\core folder.

    3. Do the changes in the theme\templates\full_header.mustache file

    4. Clear the cache in Site admin > development > purge caches