Overriding plugin renderer moodle

前端 未结 2 602
南笙
南笙 2021-01-16 06:51

I have site running Moodle 2.9.3+ and i was trying to customize the renderer of one existing plugin, so i found this:

How to override a renderer such that the functi

2条回答
  •  不知归路
    2021-01-16 07:50

    You need to do two things to get a theme renderer to override a core renderer:

    1. You need to edit the theme's config.php to add the line: $THEME->rendererfactory = 'theme_overridden_renderer_factory';
    2. You need to name your renderer class 'theme_NAMEOFTHEME_format_topcoll_renderer' (and extend 'format_topcoll_renderer', as you have done).

    The theme_overridden_renderer_factory works by extending the process of instantiating a renderer to look for a class that matches the name 'theme_NAMEOFTHEME_NAMEOFRENDERER' - as long as that class exists, then it should be used (otherwise the original renderer is used).

    See https://docs.moodle.org/dev/Overriding_a_renderer for more details.

提交回复
热议问题