weekly release 4.5dev
[moodle.git] / course / format / upgrade.txt
blob8b3f6e99c15067f0cbefeab864c494bd44db5752
1 === 4.5 Onwards ===
3 This file has been replaced by UPGRADING.md. See MDL-81125 for further information.
5 ===
6 This files describes API changes for course formats
8 Overview of this plugin type at https://moodledev.io/docs/apis/plugintypes/format
10 === 4.4 ===
11 * The core_courseformat\output\local\content\section::export_for_template() is not returning hiddenfromstudents and notavailable
12   directly in the data array anymore. Instead, it returns the visibility data in the 'visibility' key. It means that templates
13   derived from core should be adjusted to use $data->visibility->hiddenfromstudents and $data->visibility->notavailable instead
14   of $data->hiddenfromstudents and $data->notavailable.
15 * The state mutations sectionMove is deprecated. From now on sectionMoveAfter is the only
16   valid section move mutation.
17 * The state action core_courseformat\stateactions::section_move is deprecated and
18   replaced by core_courseformat\stateactions::section_move_after.
19 * $CFG->linkcoursesections setting has been completely removed because it's not required anymore. From now on, sections will be
20 always linked because a new page, section.php, has been created to display any single section.
21 * Final deprecation for:
22   - core_courseformat\output\section_renderer::section_edit_control_menu
23   - core_courseformat\output\section_renderer::section_right_content
24   - core_courseformat\output\section_renderer::section_left_content
25   - core_courseformat\output\section_renderer::section_header
26   - core_courseformat\output\section_renderer::section_footer
27   - core_courseformat\output\section_renderer::start_section_list
28   - core_courseformat\output\section_renderer::end_section_list
29   - core_courseformat\output\section_renderer::section_edit_control_items
30   - core_courseformat\output\section_renderer::section_summary
31   - core_courseformat\output\section_renderer::section_activity_summary
32   - core_courseformat\output\section_renderer::section_availability_message
33   - core_courseformat\output\section_renderer::section_availability
34   - core_courseformat\output\section_renderer::course_activity_clipboard
35   - core_courseformat\output\section_renderer::get_nav_links
36   - core_courseformat\output\section_renderer::stealth_section_header
37   - core_courseformat\output\section_renderer::stealth_section_footer
38   - core_courseformat\output\section_renderer::section_nav_selection
39   - core_courseformat\output\section_renderer::print_single_section_page
40   - core_courseformat\output\section_renderer::print_multiple_section_page
41   - core_courseformat\output\section_renderer::change_number_sections
42   - core_courseformat\output\section_renderer::format_summary_text
43   - core_course_renderer::course_section_cm_edit_actions
44   - core_course_renderer::is_cm_conditionally_hidden
45   - core_course_renderer::course_section_cm_name
46   - core_course_renderer::course_section_cm_classes
47   - core_course_renderer::course_section_cm_name_title
48   - core_course_renderer::course_section_cm_text
49   - core_course_renderer::availability_info
50   - core_course_renderer::course_section_cm_availability
51   - core_course_renderer::course_section_cm_list_item
52   - core_course_renderer::course_section_cm
53   - core_course_renderer::course_section_cm_list
54   - core_course\output\course_module_name
55   - course/format/renderer.php
56   - course/format/topics/renderer.php
57   - course/format/weeks/renderer.php
58 * New core_courseformat\sectiondelegate class. The class can be extended by plugins to take control of a course section.
59 * The methods core_courseformat\base::set_section_number() and core_courseformat\base:: get_section_number() have been deprecated
60 and replaced by core_courseformat\base::set_sectionnum() and core_courseformat\base::get_sectionnum(). The new methods use the null
61 value when all the sections must be displayed (instead of 0). That way, section 0 (General), can be displayed on a single page too.
62 * The course format setting has been updated to use a choice dropdown form element instead of a select element. Third-party
63 plugins can now include the string 'plugin_description' to provide a description of the course format.
64 * A new item, initsections, has been added to the testing_data_generator::create_course() function, to let the generator rename
65 the sections to "Section X".
66 * The core_courseformat\base::get_format_string last parameter has been removed because it was erroneous.
67 * New core_courseformat\base::add_section_preference_ids() to add the section ids to course format preferences.
68 * New core_courseformat\base::remove_section_preference_ids() to remove the section ids out of course format preferences.
70 === 4.3 ===
71 * New core_courseformat\output\activitybadge class that can be extended by any module to display content near the activity name.
72 The content of the afterlink feature has been moved to the end of the activity card so modules using it should check this new
73 feature which might fit better.
74 Some considerations about the activitybadge feature:
75   - The badge content is always plain text (no HTML).
76   - The badge style can be set (by default is initialized with badge-none, but it can be set by any module).
77   - An optional URL to redirect the user when the badge is clicked.
78   - An optional ID to add the element in case the module wants to add some JS to the badge events.
79   - Optionally, any other extra HTML attributes to the badge element (for example, data attributes).
80 * Protected function `core_courseformat\output\local\content\section\availability::availability_info()` has been deprecated,
81 `core_courseformat\output\local\content\section\availability::get_availability_data()` should be used instead.
82 * New course format output classes:
83   - core_courseformat\output\local\content\cm\groupmode output class to display the groupmode icon in the activity card.
85 === 4.2 ===
86 * New core_courseformat\base::get_context() to get the course context directly from the format instance.
87 * New core_courseformat\base::delete_module() method. Now format plugins can extend the activity deletion logic
88   by overriding this method.
89 * The reactive course editor now uses the standard fragment library to refresh an individual section or activity card
90   in the course content. Instead of using adhoc YUI methods and webservice, the new fragment methods are:
91     - core_courseformat_output_fragment_cmitem
92     - core_courseformat_output_fragment_section
93 * New methods and outputs added for bulk editing (only available for formats compatible with reactive components):
94     - Mutations for editing the bulk data: bulkEnable, bulkReset, cmSelect, cmUnselect, sectionSelect and sectionUnselect.
95     - Output classes overridable by the plugins: content\bulkedittools, content\bulkedittoggler
96     - Renderer method: core_courseformat\output\section_renderer::bulk_editing_button
97     - New overridable checkboxes: content/cm/bulkselect.mustache and content/section/bulkselect.mustache
98 * Plugins can use the CSS class "bulk-hidden" to hide elements when the bulk editing is enabled.
99 * New core_courseformat\base::duplicate_section method to duplicate course sections and their modules within a course.
100 * The section renderer will now respect the new course view parameter 'expandsection'. If the course's view page
101   is being called with this parameter set to a section number, this section will be shown expanded.
102 * core_courseformat\base::get_view_url() now by default returns a url for the *expanded* section. This can be
103   changed by adding ['expanded' => false] to the options parameter of get_view_url().
104 * The newly introduced protected method core_courseformat\output\local\content\section::is_section_collapsed() now
105   should be used by format plugins to determine if a section should be rendered collapsed or expanded at first.
106   This method can also be overwritten by course formats, but should respect the new 'expandsection' parameter when
107   doing so.
108 * New core_courseformat\base::get_editor_custom_strings() method to customize course editor strings.
109   The returned string array is used to override section related strings in the frontend.
110 * New core_courseformat\base::get_format_string() to get strings that can be overridden by the format plugin.
111   The method will check first the string in the format_PLUGINNAME.php lang file and, if not, it will return the
112   core_courseformat string instead.
113 * New course format output classes:
114   - core_courseformat\output\local\content\cm\visibility to display the activity availability.
116 === 4.1 ===
117 * New \core_courseformat\stateupdates methods add_section_remove() and add_cm_remove() have been added to replace
118   the deprecated methods add_section_delete() and add_cm_delete().
119 * The 4th param of the core_courseformat\output\local\content\cm\cmname construct is now deprecated.
120   The page edition is now detected using the course_format\base:show_editor method as the rest of the
121   core_courseformat outputs. It defaults to checking the capability 'moodle/course:manageactivities'. If different
122   capabilities are needed to check, an array of capabilities can be passed as an optional parameter to the function.
124 === 4.0 ===
125 * New core_courseformat\base::uses_course_index() to define whether the course format uses course index or not.
126 * New core_courseformat\base::supports_components() to specify if the format is compatible with reactive components.
127 * New core_courseformat\base::uses_indentation() to specify if the format is compatible with activity indentation.
128 * New core_courseformat\base::get_course_display() if the course uses COURSE_DISPLAY_SINGLEPAGE or COURSE_DISPLAY_MULTIPAGE layout.
130 === 3.10 ===
131 * Added the missing callback supports_ajax() to format_social.
133 === 3.9 ===
135 * The following functions, previously used (exclusively) by upgrade steps are not available anymore because of the upgrade cleanup performed for this version. See MDL-65809 for more info:
136     - format_topics_upgrade_remove_numsections()
137     - format_topics_upgrade_hide_extra_sections()
138     - format_topics_upgrade_add_empty_sections()
139     - format_weeks_upgrade_remove_numsections()
140     - format_weeks_upgrade_hide_extra_sections()
141     - format_weeks_upgrade_add_empty_sections()
142 * The non-ajax controls to add resources and activities are now rendered only when needed, such as when the user
143   preference is set, or when the theme sets $THEME->enablecourseajaxtheme to false. Formats which directly access
144   the '.section_add_menus' element or its children should be updated accordingly.
146 * section_header() now needs to include 'data-sectionid' => $section->section in the .section li to ensure correct section
147   selection for the Activity Chooser.
149 === 3.8 ===
151 * The following functions have been finally deprecated and can not be used anymore:
152   * section_edit_controls()
154 === 3.6 ===
155 * New method validate_format_options() cleans the values of the course/section format options before inserting them
156   in the database. Course format options can now be set in tool_uploadcourse and validation of user-submitted data is important.
157   Note that validate_format_options() is now always called when somebody creates or edits course or section and also
158   during restore and course upload. Default implementation validates against the definition of the form elements for
159   format options.
160 * The final deprecation of xxx_delete_course callback means that this function will no longer be called.
161   Please use the observer for event \core\event\course_content_deleted instead.
163 === 3.5 ===
164 * Course formats should overwrite get_config_for_external function to return the course format settings viewable by the
165   current user.
166   If the course format does not have any setting that could be considerated private (like a private/access key/token),
167   is ok to return all the settigns via the get_format_options function.
169 === 3.3 ===
170 * Javascript code for editing activities and sections was moved to an AMD module, course/rest.php is no longer
171   responsible for editing actions, instead it is done in web services. Carefully test all editing actions during upgrade.
172 * The new method format_base::allow_stealth_module_visibility() can indicate whether course format supports "stealth"
173   activities mode when they are available but not visible on course page. Course format that supports stealth mode
174   must check $cm->is_visible_on_course_page() when displaying activities list on the course page instead of $cm->uservisible.
175   For all other plugins except course formats the same property $cm->uservisible indicates if the activity contents
176   is actually available to student.
177 * Option "Number of sections" (numsections) was removed from topics and weeks formats, instead the actual number of records
178   in the course_sections table is treated as a number of sections (excluding section 0 that should always be present).
179 * Method create_course() will populate the new course with empty sections if $data->numsections is provided even if
180   "numsections" is not an option defined by the course format.
181 * course/changenumsections.php can now be used to insert sections at any positions.
182 * The variable SECTIONLEFTSIDE was changed from '.left .section-handle img' to '.left .section-handle .icon' in
183   course/format/topics/format.js and course/format/weeks/format.js due to the introduction of Font Awesome (see MDL-40759)
184   which altered the HTML. Please check if your course format relies on this selector, and if so, update it.
186 === 3.2 ===
187 * Callback delete_course is deprecated and should be replaced with observer for event \core\event\course_content_deleted
188 * Course formats can overwrite get_default_course_enddate function to set the default course end date for new courses.
189   format_base::get_default_course_enddate uses the new "Course duration" site setting to calculate the default course end date
190   from the default course start date.
191 * New method format_base::supports_news() which is used to determine whether an Announcements forum will be automatically created on
192   course creation. For course format plugin developers, please override format_base::supports_news() to return true if you want the
193   Announcements forum to be created upon course creation and remove the block names defined in format_base::get_default_blocks().
195 === 3.1 ===
196 * Course format may use the inplace_editable template to allow quick editing of section names, see
197   https://docs.moodle.org/dev/Inplace_editable and MDL-51802 for example implementation.
199 === 3.0 ===
200 * Course formats should now use section_edit_control_items and use the returned array of controls items and their attributes to create a
201   renderable menu or array of links.  Plugin calls to section_edit_controls will now include the section edit control in the returned array.
202 * The section name is now wrapped in a new span (.sectionname > span), process_sections method in format.js should be updated so .sectionname
203   DOM node's wraps the section title in a span. You can look at how to implement the change in course/format/topics/format.js or MDL-48947.
204 * New method format_base::get_default_section_name retrieves the default section name for the given course format. The base
205   implementation basically uses the implementation of format_base::get_section_name. The method can be overridden in
206   format_base subclasses that use sections (i.e. format_topics, format_weeks). In relation to the changes made for the default
207   section name, the default section name is now being shown when editing the section information.
209 === 2.9 ===
210 * Course formats may support deleting sections, see MDL-10405 for more details.
211   format_section_renderer_base::section_edit_controls() is now also called for
212   stealth sections and it also returns "delete" control.
214 === 2.8 ===
215 * The activity chooser now uses M.course.format.get_sectionwrapperclass()
216   to determine the section selector, rather than a hard-coded `li.section`.
217 * Activity duplication in /course/modduplicate.php is deprecated and is now done in /course/mod.php.  Deprecated calls will be honored by
218   redirecting to /course/mod.php for 3rd party plugin support.
219 * New method format_base::section_get_available_hook() allows plugins to override section availability.
221 === 2.7 ===
222 * The ->testedbrowsers array no longer needs to be defined in supports_ajax().
223 * format_section_renderer_base::section_hidden has an new second optional argument $courseorid.
224   If provided the section name is printed in the not available string when displaying the hidden section.
226 === 2.6 ===
228 * core_course_renderer::course_section_cm_edit_actions has two new optional arguments and now uses and action_menu component.
229 * core_course_renderer::course_section_cm has been altered to call core_course_renderer::course_section_cm_edit_actions with the two new arguments
230 * An additional course renderer function has been created which allows you to
231   specify the wrapper for a course module within a section (e.g. the <li>).  This can be
232   found in core_course_renderer::course_section_cm_list_item().
234 === 2.5 ===
236 * Functions responsible for output in course/lib.php are deprecated, the code is moved to
237   appropriate renderers: print_section(), print_section_add_menus(), get_print_section_cm_text(),
238   make_editing_buttons()
239   See functions' phpdocs in lib/deprecatedlib.php
240 * Function get_print_section_cm_text() is deprecated, replaced with methods in cm_info
242 === 2.4 ===
244 Course format API has been changed significantly. Instead of implementing callbacks course formats
245 may overwrite the class format_base. See format_legacy class for a template for upgrading course
246 format.
248 * Function settings_navigation::add_course_editing_links() is completely removed, course format
249   functions callback_XXXX_request_key() are no longer used (where XXXX is the course format name)
250 * functions get_generic_section_name(), get_all_sections(), add_mod_to_section(), get_all_mods()
251   are deprecated. See their phpdocs in lib/deprecatedlib.php on how to replace them
252 * Course formats may now have their settings.php file as the most of other plugin types
253 * Function format_section_renderer_base::is_section_current() is deprecated, overwrite/use
254   function is_section_current in format class
256 === 2.3 ===
258 * The new $course->coursedisplay option was introduced, users can now choose to display
259   a section at a time if the course formats support it:
260  - COURSE_DISPLAY_SINGLEPAGE indicates the teacher has chosen to display all sections on one page
261  - COURSE_DISPLAY_MULTIPAGE indicates the teacher has chose to have seperate pages with each section.
263 * The parameter for 'currently active section' was standardised in core:
264   - The course format is passed the currently live section through the $displaysection varaible to format.php
265   - A 'section' paramter is the standardised way to pass around the current section in a course
266   - Navigation no longer looks for custom parameters defined in callback_format_request_key