-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.1.1
-
MOODLE_401_STABLE
Hi,
since I have not found a way to extend the course index within a theme for version 4.x, I would appreciate if the function export_for_template in the cm class /output/local/state) could be extended to include the modname.
'modname' => $cm->modname, (but not the translated modname as it is now in V4.2).
Thus it would be possible for example to insert an icon for the activities in the template or with CSS.
In courses with a lot of content or the setting "one section per page" this would be a great feature for the participants.
The proposal in point 4 at MDL-75356 would of course improve everything.
Regards,
Daniel
Technical shaping
The course index is rendered via javascript using pure frontend data. This means the course index cannot access the PHP renderers, and MDL-75356 won't help much here. Themes can easily override the course index templates easily and even override the section renderer course_index_drawer method to replace the course index widget completely.
It is important to note that, in javascript rendered templates, the output data cannot be modified by themes. The fact the course index is more prominent than other UI elements does not make a difference.
However, if there is a real need for that, one possible solution is to allow themes to add extra data to the state levels (course, section, cm). There are several scenarios here:
- Modify core_courseformat\base::get_output_classname to scan also any possible theme output class if available. This way themes could also override individual theme_PLUGINAME\output\courseformat\state* classes. However, specific format plugins can provide their alternative classes and themes should know about them. This approach is proposed in a comment in MDL-75356.
- Modify the core_courseformat_get_state webservice (implemented in course/format/classes/external/get_state.php) to do an extra check for theme_PLUGINAME\courseformat\extrastate class and allow the theme to add extra data to each individual level (course, section, cm). This will allow themes to modify the state independently from the format plugin.