Moodle 2.9.3+ issue overriding Collapsible topics

Moodle 2.9.3+ issue overriding Collapsible topics

by Brandon Jimenez -
Number of replies: 4

I have site running Moodle 2.9.3+ and i was trying to customize the renderer of Collapsible topics, so I added the following into the core_renderer.php of my theme: 

include_once($CFG->dirroot . "/course/format/topcoll/renderer.php");

but when i tried to do

    class topcoll_local_renderer extends format_topcoll_renderer {
      protected function section_header($section, $course, $onsectionpage, $sectionreturn = null) {
    ...
      }
    }

it runs, but it's not loading the modified function. Do I need to do anything else? the modified function is running with no issues when I alter the code directly into the plugin, but not like this. I would greatly appreciate any possible hint.


Thanks

Average of ratings: -
In reply to Brandon Jimenez

Re: Moodle 2.9.3+ issue overriding Collapsible topics

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

You could try to use another name for your class:

class format_mytheme_renderer extends format_topcol_renderer

Average of ratings: Useful (1)
In reply to Renaat Debleu

Re: Moodle 2.9.3+ issue overriding Collapsible topics

by Brandon Jimenez -

Thank you very much!

In reply to Brandon Jimenez

Re: Moodle 2.9.3+ issue overriding Collapsible topics

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

The core_renderer is one hierarchy and CT's renderer is in another.  This may confuse things.

Example of using with autoloaded renderers in a theme with traits: https://github.com/gjb2048/moodle-theme_essential/blob/master/classes/format_topcoll_renderer.php

In reply to Gareth J Barnard

Re: Moodle 2.9.3+ issue overriding Collapsible topics

by Brandon Jimenez -

i was able to modify the renderer in my own local theme. Thanks to both of you