Overriding core_search_renderer in a Boost child theme

Overriding core_search_renderer in a Boost child theme

by Fabio Krämer -
Number of replies: 1

Hi,

I want to override core_search_renderer - /search/classes/output/renderer -  in a theme that inherits from theme_boost.

I read the following forum posts and tried to override the renderer in my theme, but changes don't show up.

https://moodle.org/mod/forum/discuss.php?d=346494

https://moodle.org/mod/forum/discuss.php?d=324201


This Code is placed in : theme/knowbase/classes/output/core_search_renderer.php . Theme knowbase inherits from theme boost.


namespace theme_knowbase\output;

defined('MOODLE_INTERNAL') || die;

class theme_knowbase_core_search_renderer  extends \core_search\output\renderer {

    public function render_results($results, $page, $totalcount, $url, $cat = null) {

    }
}

Could someone tell me why my changes in theme_knowbase_core_search_renderer  don't show up?


Fabio


Average of ratings: -
In reply to Fabio Krämer

Re: Overriding core_search_renderer in a Boost child theme

by Fabio Krämer -

Update: After removing the namespace, the changes were  displayed.

This is the solution:

Code is placed in : theme/knowbase/classes/output/core_search_renderer.php . Theme knowbase inherits from theme boost.


defined('MOODLE_INTERNAL') || die;

class theme_knowbase_core_search_renderer  extends \core_search\output\renderer {

    public function render_results($results, $page, $totalcount, $url, $cat = null) {

    }
}

Average of ratings: Useful (1)