Moving the activity title

Re: Moving the activity title

by Tristan Roscoe -
Number of replies: 0

I'm assuming you created a child theme based on boost, if not this is a great place to start:
https://docs.moodle.org/dev/Creating_a_theme_based_on_boost

That being said the tutorial only goes so far. Not everything can be done with mustache files yet although I believe they continue to develop boost dropping more and more into templates.
https://docs.moodle.org/dev/Templates

If you are used to traditional theme dev then you should be no stranger to overriding a renderer:
https://docs.moodle.org/dev/Overriding_a_renderer

Drop this into /moodle/theme/your_theme/classes/core_renderer.php

class theme_your_theme_core_renderer extends \theme_boost\output\core_renderer {
    public function heading($text, $level = 2, $classes = null, $id = null) {
        global $PAGE;

        if (strpos($PAGE->pagetype, 'mod-') === 0) {
            if ($level == 1) {
                if (($tmp = strstr($PAGE->title, ': ')) !== false) {
                    $text = substr($tmp, 1);
                }
            } else if ($level == 2) {
                return;
            }
        }

        return parent::heading($text, $level, $classes, $id);
    }
}

If you want to target different modules you can change "mod-" to something like "mod-book".