Hi All
This is different to the usual "how do I override a renderer in my theme?" problem, hence my posting the question.
So what I am trying to do is override the output from the myoverview block (which produces the "Course overview" content on the Dashboard page) and add an "un-enrol me" link to each course record displayed.
I can override the mustache templates and add the extra elements to display the link, no problem. However, I need to generate the link and pass it into the renderer context and this is where I have a problem.
The block has the following renderer structure:
myoverview - classes - output + courses-view.php + main.php + renderer.php
and I believe I need to inject the link in courses-view.php, so to that effect I have created an override in my theme:
mytheme - classes - output - block_myoverview - courses-view.php
courses-view.php <?php // This file is part of Moodle - http://moodle.org/ // ... namespace theme_mytheme\output\block_myoverview; defined('MOODLE_INTERNAL') || die(); ... /** * Export this data so it can be used as the context for a mustache template. * * @param \renderer_base $output * @return array */ public function export_for_template(renderer_base $output) { global $CFG; ... foreach ($this->courses as $course) { ... $exportedcourse = $exporter->export($output); ... $exportedcourse->unenrollink = $this->generate_unenrol_link($course); // Uses a custom function to generate link ... } ... }
However, this override is not being picked up =(
Does it have the wrong namespace, is it in the wrong location, or is it not possible to do this?
Any help greatly appreciated!
Cheers
Raad
~~
Raad Al-Rawi
Moodle Technical Developer/DBA
University of Cambridge