-
Improvement
-
Resolution: Inactive
-
Minor
-
None
-
2.0
-
None
-
MOODLE_20_STABLE
Course formats (and local plugins) often need to store custom settings per course. This prohibits them from using the admin settings functionality built into Moodle.
The attached patch makes it easy to insert a navigation link to a custom settings page provided by a course format or local plugin. This only provides a convenient hook into navigation, the format/plugin would still be responsible for a database table to persist settings, a UI to edit settings, and code to load/save settings.
This patch does not change the current behavior unless a format/plugin uses it. If a format/plugin does add a navigation node, the current "Edit Settings" node will be changed to a TYPE_CONTAINER with the additional settings within it (similar to Question Bank).
EXAMPLE:
If a course format wants to add custom course settings they first add a xxx_extend_course_settings function to their /course/format/xxx/lib.php file. This function will be called when building the course navigation. The format should add a new navigation link to the given settings node:
function myformat_extend_course_settings($course, $settingsnode) {
|
$url = new moodle_url('/course/format/myformat/coursesettings.php', array('id'=>$course->id));
|
$settingsnode->add(get_string('settings', 'format_myformat'), $url, navigation_node::TYPE_SETTING);
|
}
|
The format would then write a page similar to /course/edit.php to display, edit and save the settings.
More discussion in the forum.
- has been marked as being related by
-
MDL-35218 META: Course formats refactoring for 2.4
-
- Closed
-