1 This files describes API changes in /course/*,
2 information provided here is intended especially for developers.
5 * The following behat steps are now deprecated and replaced by new ones with no Javascript dependencies:
6 - I add a ":activityname" to section ":sectionnum"
7 - I add a ":activityname" to section ":sectionnum and I fill the form with:"
9 - I add a :activityname to section :sectionnum using the activity chooser
10 - I add a :activitypluginname activity to course :coursefullname section :sectionnum
11 - I add a :activitypluginname activity to course :coursefullname section :sectionnum and I fill the form with:
12 * set_coursemodule_visible() has a new $rebuildcache parameter. If this is being called multiple times in the same request,
13 consider passing `false` for this parameter and rebuilding the cache once after all the course modules have been updated.
14 See course_update_section() for an example.
15 * The external function core_course::get_courses_by_field now returns the communication tool configuration for the course.
16 - communicationroomname: the room name
17 - communicationroomurl: the tool url
18 * The following previously deprecated methods have been removed and can no longer be used:
19 - `course_purge_section_cache`
20 - `course_purge_module_cache`
21 - `get_array_of_activities`
22 * New format actions classes. Those classes will eventually replace all course/lib.php content editing functions.
23 All new methods are distributed in three classes formats can extend. Method can be accessed using static
24 methods (see doc block of core_courseformat\formatactions for more information).
25 * The monologo activity icons have been improved and .png files have been removed (although the API still supports them).
26 The background for these icons has been removed and the color is used now for outlining their shapes.
27 About the categories supported by the FEATURE_MOD_PURPOSE:
28 * A new category has been added: MOD_PURPOSE_INTERACTIVECONTENT.
29 * The MOD_PURPOSE_INTERFACE category has been deprecated. The styles associated with this category have been removed.
30 The colors for all these purposes and the filters applied to outline them are defined in theme/boost/scss/moodle/variables.scss
31 * New hooks for extending course form:
32 - core_course\hook\after_form_definition
33 - core_course\hook\after_form_definition_after_data
34 - core_course\hook\after_form_validation
35 - core_course\hook\after_form_submission
36 * New behat step using the URL resolvers:
37 - When I am on the "Course > <section> "course > section" page logged in as "<username>". When utilizing 'Section x'
38 it first searches by section name (Section x). If it's not found, then it searches by the section number (x).
41 * The `core_course_renderer::course_section_cm_completion` method has been removed, and can no longer be used
42 * External function core_course_external::get_course_contents() now returns a new field activitybadge with the data to display
43 the activity badge when the module implements it.
44 * prepare_new_moduleinfo_data() now accepts a parameter "suffix" that will be added to the name of the completion rules.
45 * The method core_course_bulk_activity_completion_renderer:: edit_default_completion() has been deprecated and will be removed.
46 * The `core_course\output\activity_information` output class has been deprecated. Use `core_course\output\activity_completion`
47 and `core_course\output\activity_dates` instead.
48 Alongside with that, the following methods have been deprecated too:
49 - `core_course_renderer::render_activity_information()`
50 - `renderer_base::activity_information()`
53 * course/mod.php now accepts parameter beforemod for adding course modules. It contains the course module id
54 of an existing course module. The new module is inserted before this module.
55 * The function duplicate_module() now has two new optional parameters:
56 - $sectionid to specify section the duplicated course module is placed in
57 - $changename to disable changing the name of the course module using the 'duplicatedmodule' lang string
58 * The method `make_categories_options`, deprecated since 3.10, has been removed
59 * External function core_course_external::get_courses_by_field and core_course_external::search_courses now return a field
60 called "courseimage" containing a URL pointing to the course image.
61 * External function core_course_external::get_course_contents() does not throw exceptions for invalid course formats anymore.
64 * The function course_modchooser() has been finally deprecated and can not be used anymore. Please use
65 course_activitychooser() instead.
66 * A critical accessibility issue is been found (MDL-74800) at the output class
67 core_courseformat\output\local\content\cm\cmname. To solve the problem this output element is not
68 rendered anymore using inplace_editable but using a regular named_templatable interface.
69 Some format plugins that override the deprecated renderer method course_section_cm_name can be affected.
70 Check the current course_section_cm_name code to see how to render it properly.
73 * All activity icons have been replaced with black monochrome icons. The background
74 colour for these icons is defined using a new 'FEATURE_MOD_PURPOSE' support variable in the module lib.php file
75 Available purpose types are:
76 - MOD_PURPOSE_COMMUNICATION
77 - MOD_PURPOSE_ASSESSMENT
78 - MOD_PURPOSE_COLLABORATION
80 - MOD_PURPOSE_ADMINISTRATION
81 - MOD_PURPOSE_INTERFACE
83 The colours for these types are defined in theme/boost/scss/moodle/variables.scss
84 * The format_base is now deprecated. Use core_courseformat\base instead.
85 * The new course output components deprecate many renderer methods from course
86 renderer and course format renderer:
87 - core_courseformat\output\local\content: to render the general course structure
88 - core_courseformat\output\local\content\section: to render a section
89 - core_courseformat\output\local\content\cm: to render an activity card inside a section
90 - core_courseformat\output\local\content\cm\*: to render parts of the course structure
91 - core_courseformat\output\local\content\section\*: to render parts of the course section
92 * The previous format renderer page_title method has been moved to course_format::page_title
93 * New format renderer methods to interact with the new output components:
94 - render: override the default templatable mustache location for the new course components.
95 - course_section_updated_cm_item: used when the course editor needs to update a cm item HTML.
96 - render_content: contrib formats should override this method to change the default template.
97 * The following methods are adapted to use outputs but with a deprecation warning and should not be used anymore:
98 - print_single_section_page (replaced by core_courseformat\output\local\content)
99 - print_multiple_section_page (replaced by core_courseformat\output\local\content)
100 - course_activity_clipboard (integrated in replaced by core_courseformat\output\local\content)
101 - format_summary_text (replaced by core_courseformat\output\local\content\section\summay)
102 - change_number_sections (replaced by core_courseformat\output\local\content\addsection)
103 - course_section_cm_list_item (replaced by core_courseformat\output\local\content\section\cmitem)
104 - course_section_cm (replaced by core_courseformat\output\local\content\cm)
105 - course_section_cm_list (replaced by core_courseformat\output\local\content\section\cmlist)
106 - section_edit_control_menu (replaced by core_courseformat\output\local\content\section\controlmenu)
107 - section_right_content (integrated in core_courseformat\output\local\content\section)
108 - section_left_content (integrated in core_courseformat\output\local\content\section)
109 - section_header (replaced by core_courseformat\output\local\content\section\header)
110 - section_footer (integrated in core_courseformat\output\local\content\section)
111 - section_edit_control_items (replaced by core_courseformat\output\local\content\section\controlmenu)
112 - section_summary (replaced by core_courseformat\output\local\content\section\summary)
113 - section_activity_summary (replaced by core_courseformat\output\local\content\section\cmsummary)
114 - section_availability_message (integrated in core_courseformat\output\local\content\section\availability)
115 - section_availability (replaced by core_courseformat\output\local\content\section\availability)
116 - get_nav_links (replaced by core_courseformat\output\local\content\sectionnavigation)
117 - stealth_section_header (replaced by core_courseformat\output\local\content\section\header)
118 - stealth_section_footer (integrated in by core_courseformat\output\local\content\section)
119 - section_nav_selection (replaced by core_courseformat\output\local\content\sectionselector)
120 - course_section_cm_edit_actions (replaced by core_courseformat\output\local\content\cm\controlmenu)
121 - is_cm_conditionally_hidden (incorporated in core_availability\info_module::is_available_for_all)
122 - course_section_cm_name (replaced by core_courseformat\output\local\content\cm\cmname)
123 - course_section_cm_classes (integrated in core_courseformat\output\local\content\cm)
124 - course_section_cm_name_title (replaced by core_courseformat\output\local\cm\title)
125 - course_section_cm_text (integrated in core_courseformat\output\local\content\cm)
126 - course_section_cm_availability (replaced by core_courseformat\output\local\content\cm\availability))
127 - start_section_list (integrated in core_courseformat\output\local\content)
128 - end_section_list (integrated in core_courseformat\output\local\content)
129 * The following abstract methods are deleted:
130 - page_title (moved to core_courseformat\output\local\content)
131 * Course formats should have a renderer (until now it was only highly recommended but not mandatory). For backwards
132 compatibility (to not break third-party plugins without it), legacy_format_renderer has been created and will be used when
133 course formats don't have their own renderer.
134 * New external core_courseformat\external\get_state returns current state information for a given course.
135 * New external core_courseformat\external\update_course runs given action to edit course and gets the affectated state objects.
136 * New external core_course\external\get_state returns current state information for a given course.
137 * New external function core_course_update_course runs given action to edit course status.
138 * The `\core\event\course_category_deleted` event is now created with a snapshot of the category record being deleted,
139 available inside event observers via `$event->get_record_snapshot`
140 * New include_course_editor() function to include and configure course editor modules.
141 * New core_course_drawer() function to render the message drawer in the top of the body of each page.
142 * New course_get_enrolled_courses_for_logged_in_user_from_search which hooks in with external\get_enrolled_courses_by_timeline_classification
143 given COURSE_TIMELINE_SEARCH is set then get_enrolled_courses_by_timeline_classification will deviate to use a string search of enrolled courses.
144 * Class core_course\output\course_module_name is deprecated. Now core_courseformat\output\local\content\cm\cmname controls inline edit.
145 * Calendar menu entry is now moved to User menu items, so the following methods will not return the calendar item anymore:
146 - course_get_user_navigation_options
147 - core_course_externalcore_course_external::get_user_navigation_options
148 * New external \core_course\external\get_enrolled_courses_with_action_events_by_timeline_classification:
149 - Returns courses the user is enrolled in which contain at least one action event in the supplied time/text filtering parameters.
150 - Provides a similar response to get_enrolled_courses_by_timeline_classification, but omits courses which have no matching
152 * The following functions have been deprecated in favour the tertiary navigation constructs:
155 - print_course_request_buttons
156 * New page_setup() method in the core_course_category class. This method can be used for a general page setup in the course
158 * New core_course_category::get_nearest_editable_subcategory():
159 - Return the core_course_category object for the first subcategory that the current user has the permission on it.
160 * The method navigation() in the core_course_bulk_activity_completion_renderer class has been deprecated as the tabs navigation
161 structure in the course competency pages has been replaced with tertiary navigation. To render the navigation, please
162 render_course_completion_action_bar() instead.
163 * The following functions have been deprecated in favour partial course cache rebuild:
164 - course_purge_section_cache (replaced by course_modinfo::purge_course_section_cache_by_id() and course_modinfo::purge_course_section_cache_by_number())
165 - course_purge_module_cache (replaced by course_modinfo::purge_course_module_cache())
166 - get_array_of_activities (replaced by course_modinfo::get_array_of_activities() for better performance)
167 * New course_modinfo::purge_course_cache function was created to purge the cache of a given course.
170 * A new callback xxx_coursemodule_definition_after_data that allows plugins to extend activity forms after the data is set.
171 * \core_course_renderer::course_section_cm_completion() has been deprecated. It is not being used anymore and is being replaced by
172 \core_renderer::activity_information().
173 * New Behat steps for checking activity date information in the \behat_course class:
174 - activity_date_in_activity_should_contain_text()
175 - Given the activity date in "<ActivityName>" should contain "<Text>"
176 - activity_dates_information_in_activity_should_exist()
177 - Given the activity date information in "<ActivityName>" should exist
178 - activity_dates_information_in_activity_should_not_exist()
179 - Given the activity date information in "<ActivityName>" should not exist
180 * A user preference usemodchooser has been removed and the activities/resources (non-ajax) activity chooser has been deprecated and will be removed in the future.
184 * The function make_categories_options() has now been deprecated. Please use \core_course_category::make_categories_list() instead.
185 * External function core_course_external::get_course_contents now returns a new field contextid with the module context id.
186 * The core_course_external class methods get_courses(), get_courses_by_field() and search_courses() now return a "valueraw" property
187 for each custom course field, which contains the original/unformatted version of the custom field value.
191 * The function get_module_metadata is now deprecated. Please use \core_course\local\service\content_item_service instead.
192 * Activity module names are now PARAM_ALPHANUM instead of PARAM_ALPHA so integers can be used in activity module names
193 * The following functions have been added to core_course_renderer class to have more granularity. They can be overriden in
196 - course_enrolment_icons
199 - course_overview_files
200 - course_category_name
201 - course_custom_fields
205 * The following functions have been finally deprecated and can not be used any more:
206 - core_course_external::get_activities_overview
207 * External function core_course_external::get_enrolled_courses_by_timeline_classification now also supports the classification
208 'allincludinghidden' which delivers all courses including hidden courses. The classification 'all' still returns all courses
209 without hidden courses.
213 * The course pattern function in course_summary_exporter::get_course_pattern has been moved to $OUTPUT->get_generated_image_for_id.
214 * The course color function in course_summary_exporter::coursecolor has been moved to $OUTPUT->get_generated_color_for_id.
215 * External function core_course_external::get_course_contents new returns the following additional completiondata field:
216 - valueused (indicates whether the completion state affects the availability of other content)
217 * External function core_course_external::get_course_contents now returns a new contentsinfo field with summary files information.
218 * External function core_course_external::get_course_contents now returns an additional field "tags" returning the content tags.
222 * External function core_course_external::get_course_public_information now returns the roles and the primary role of course
224 * External function core_course_external::get_course_contents now return the following additional file fields:
225 - onclick (onclick javascript action code)
226 - afterlink (after link info to be displayed)
227 - customdata (module custom data (JSON encoded))
228 - completion (to indicate if completion is enabled or not)
229 - completiondata (completion status for the current user in the module)
230 * External function core_group_external::get_course_user_groups now can return all user courses group information.
234 * There is a new capability 'moodle/course:setforcedlanguage' to control which users can force the course
235 language; create_course and update_course functions delegate access control to the caller code; if you
236 are calling those functions you may be interested in checking if the logged in user has 'moodle/course:setforcedlanguage' capability.
240 * External function core_course_external::get_courses_by_field now returns the course filters list and status.
241 * External function core_course_external::get_courses_by_field now returns the end date of the course.
242 * External function core_course_external::get_course_contents now return the following additional file fields:
243 - mimetype (the file mime type)
244 - isexternalfile (if is a file reference to a external repository)
245 - repositorytype (the repository name in case is a external file)
246 Those fields are VALUE_OPTIONAL for backwards compatibility.
247 * External function core_course_external::get_course_contents now return the following fields for section and modules:
248 - uservisible (whether the section or module is visible by the user)
249 - availabilityinfo (availability information if the course or module has any access restriction set
253 * External function core_course_external::get_course_contents now returns the section's number in the course (new section field).
254 * External function core_course_external::get_course_contents now returns if a section is hidden in the course format.
255 * External functions that were returning file information now return the following file fields:
256 filename, filepath, mimetype, filesize, timemodified and fileurl.
257 Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.
258 * The modchooser now uses a renderable and a template, thus its associated renderer
259 methods have been deprecated. Note that the call to core_course_render::course_modchooser,
260 is still required. Deprecated methods:
261 - core_course_renderer::course_modchooser_module_types
262 - core_course_renderer::course_modchooser_module
263 - core_course_renderer::course_modchooser_title
264 * You can now specify a course end date when calling core_course_external::create_courses and core_course_external::update_courses
265 external functions. core_course_external::get_courses external function is now returning courses end date values.