Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-24348

[Patch] Custom course settings for course formats and local plugins

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Inactive
    • 2.0
    • None
    • Course
    • None
    • MOODLE_20_STABLE

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              blt04 Brandon Turner
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: