On my theme for moodle 2.7 I customised the html for the module chooser panel simply by overriding course/renderer.php 'public function course_modchooser($modules, $course)'.
There were some changes on moodle 3.2 and now I am having trouble overriding it (it uses a renderable widget now (?)). Can anyone point me in the right direction in how to override it?
How I was able to override modchooser on 3.2+:
- On theme renderers.php override public function course_modchooser(...), calling $modchooser = new \theme_MYTHEMENAME\output\modchooser($course, $modules);
- Copy course/classes/output/modchooser.php to your theme (same directories) and change "namespace theme_mythemename\output;" Make all (LOGIC) changes you wish to make;
- Copy lib/templates/chooser.mustache to your theme "templates/core/chooser.mustache" and make your HTML changes.
- Make any CSS changes on your theme style file(s).
I also have a module chooser override which has worked well from mdl 2.7 to 3.1.
I've tried using your approach to apply an override in mdl 3.3 but can't quite get there.
As well as copying modchooser.php to my theme and changing its namespace, I also had to do the same with modchooser_item.php (or change all references to it to its real path so it could be found).
Do you know of any well documented basic working examples of a modchooser override for mdl 3.3 which could work as a good point in the right direction?
I found my main problem.
As well as "overriding public function course_modchooser(...), calling $modchooser = new \theme_MYTHEMENAME\output\modchooser($course, $modules);"...
I needed to add the call to the render function with
I now have a working clone of the core modchooser with the exception of the "cancel" button throwing a missing required parameter (jump) in /course/jumpto.php