I am writing my own custom module on Moodle 3.9. I am trying to control the availability of the activity. On a page that list all the available activity of the course, I created an activity with multiple restriction criteria (date and gouping).
To display the restrictions criteria, the ->availableinfo property now contain a renderable object which is supposed to be rendered with core_availability_renderer in availability/renderer.php.
When I try to use this renderer, I have the following error: Exception - Too few arguments to function plugin_renderer_base::__construct(), 0 passed in [dirroot]/mod/xxx/classes/output/index_page.php on line 155 and exactly 2 expected. The expected params are moodle_page $page and $target.
Problem #1 - Moodle doc recommend to use $this->page instead of $PAGE but in my case $this->page is null. Do I need to do something special to have $this->page populated?
Problem #2 - I do not understand what the $target variable can be. Anyone has an idea on this? See lib/outputrenderers.php on line 419 or https://github.com/moodle/moodle/blob/4d9ab4ca4825d689dcd49767c101eb5139705f33/lib/outputrenderers.php#L418
Thank you for your help in advance.