Hello everyone
I am in process of creating a theme that will override various renderers to modify look and feel of moodle.
Right now i am following cleanm theme which uses auto loading to override core renderer, my requirement was to override the following renderers:
1. Block settings renderer '/blocks/settings/renderer.php'
2. Course Renderer '/course/renderer.php'
/theme_themename/output was the namespace i used to override core_renderer and it worked fine as i can override any function from core_renderer class, but the same is not happening with the two renderers described above.
Steps i followed (to override course renderer):
- Created a class in themename/classes/output directory, the file name is course_renderer.php.
- Tried the following class names:
- class core_course_renderer extends \core_course_renderer
- class theme_themename_course_renderer extends \core_course_renderer
- Namespace
- namespace theme_mdltheme\output
- namespace theme_mdltheme\output\course\renderer;
- namespace theme_mdltheme\output\course_renderer;
Steps i followed (to override blocks settings renderer):
- Created a class in themename/classes/output directory, the file name is block_settings_renderer.php.
- Tried the following class names:
- class block_settings_renderer extends \core_course_renderer
- theme_themename_block_settings_renderer extends \block_settings_renderer
- Namespace
- namespace theme_mdltheme\output
- namespace theme_mdltheme\output\blocks\settings\renderer;
None of the above worked as i can not override any functions in these classes. I have tried many variations in namespaces but could not find any solution.
I noticed both these classes i am trying to override by auto loading does not use namespaces, so could this be the reason?
I do not want to require the class first using 'require_once($CFG->dirroot . "/blocks/settings/renderer.php");'
Any help would be appreciated.