How to handle custom fields in 3.7 child theme?

Re: How to handle custom fields in 3.7 child theme?

by Renaat Debleu -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

No new tracker issue created because I found a solution modifying the course_renderer:

theme/my_theme/classes/output/core/course_renderer.php
++ use core_course\customfield\course_handler;
++ use core_customfield\data_controller;
++ use core_customfield\field_controller;

...

protected function coursecat_coursebox_content(\coursecat_helper $chelper, $course) {
...
// Display custom fields.
if ($course->has_custom_fields()) {
   -- $handler = core_course\customfield\course_handler::create();
++ $handler = \core_course\customfield\course_handler::create();
   $customfields = $handler->display_custom_fields_data($course->get_custom_fields());
   $content .= \html_writer::tag('div', $customfields, ['class' => 'customfields-container']);
}