MDL-65974 course: move format renderers to outputs

This commit is contained in:
Ferran Recio 2020-10-22 09:22:54 +02:00
parent 1c839f9072
commit 8e7dc42440
49 changed files with 3553 additions and 1958 deletions

View file

@ -9,6 +9,10 @@ below.
If you want to store information in the database for your format, or control
access to features of your format, you need some of the optional files too.
If you want to override some standard course output component (located in
coure/classes/output/{course|section|cm}_format/*) you need to create an
extend class inside your course/format/yourformat/classes/output.
All names below assume that your format is called 'yourformat'.
@ -139,3 +143,31 @@ Optional file (styles)
If this file exists it will be included in the CSS Moodle generates.
Optional files (outputs)
----------------------
By default, the format renderer will use those output classes:
* core_course\output\course_format: for the general course structure
* core_course\output\course_format\*: to render specific course structure parts
* core_course\output\section_format: for the complete section output
* core_course\output\section_format\*: to render specific section parts
* core_course\output\cm_format: for output an activity inside a section
* core_course\output\cm_format\*: for speficis parts of the cm output
Your format can override any of this output classes just by creating class
inside your format_yourformat\output\ classes. We recommend to extend the
original class to ensure all element will work as expected.
For example: if you want to change the section header, you should create
format_yourformat\output\section_format\header, which will extend the original
core_course\output\section_format\header class.
By default, only two format renderer methods are needed to render a course:
- render_course_format to render a full course
- course_section_updated_cm_item used by the course editor to refresh a specific cm item
Formats can override those two methods to use different templates to render a course.