Insert a banner above every course page - regardless of course format

Re: Insert a banner above every course page - regardless of course format

by Mark Sharp -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

There are a couple of things you could do on the PHP side.

  1. Override the course format in your own theme. If you're overriding the weeks format, for example,
    1.  add a file to your theme at: /theme/mytheme/classes/format_weeks_renderer.php
    2. Add the class theme_mytheme_format_weeks_renderer extends format_weeks_renderer
    3. Add the function protected function section_summary
    4. Add you code in there (see attachment)
  2. Override the core renderer - see https://docs.moodle.org/dev/Overriding_a_renderer
    1. If you look at columns2.mustache, you will see a bunch of {{{ output.nameofsomefunction }}} e.g. output.full_header, output.course_content_header
    2. Each of those you can override in your core renderer.
    3. You can also add your own functions to your overridden core renderer, just by creating the function, and adding the appropriate output tag.
    4. {{{output.whateveryouwant}}}
    5. function whateveryouwant()
Attachment formatweeks.png