Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
50 changes: 25 additions & 25 deletions docs/apis/plugintypes/format/_examples/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@
use moodle_page;

/**
* Basic renderer for pluginname format.
*
* @copyright 2022 Someone <someone@somewhere.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends section_renderer {
* Basic renderer for pluginname format.
*
* @copyright 2022 Someone <someone@somewhere.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends section_renderer {
// Override any necessary renderer method here.

/**
* Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
* @return string HTML to output.
*/
* Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title($section, $course) {
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section));
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section));
}

/**
* Generate the section title to be displayed on the section page, without a link.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param int|stdClass $course The course entry from DB
* @return string HTML to output.
*/
* Generate the section title to be displayed on the section page, without a link.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param int|stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title_without_link($section, $course) {
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section, false));
}
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section, false));
}
}
2 changes: 1 addition & 1 deletion docs/apis/plugintypes/format/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tags:

import { getExample } from '@site/src/moodleBridge';

The new course editor introduced n Moodle 4.0 reimplements most of the previous webservices, AMD modules, and internal logic of the course rendering. However, all formats since 3.11 will use the previous libraries by default until its final deprecation in Moodle 4.3. This document collects the main adaptations any 3.11 course format will require to continue working when this happens.
The new course editor introduced in Moodle 4.0 reimplements most of the previous webservices, AMD modules, and internal logic of the course rendering. However, all formats since 3.11 will use the previous libraries by default until its final deprecation in Moodle 4.3. This document collects the main adaptations any 3.11 course format will require to continue working when this happens.

## Changes summary

Expand Down
2 changes: 1 addition & 1 deletion docs/apis/plugintypes/mod_forum/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tags:
documentationDraft: true
---

The `mod_fporum` activity can be extended using the `forumreport` sub-plugin type. This hasn't been documented yet - perhaps you are able to help us.
The `mod_forum` activity can be extended using the `forumreport` sub-plugin type. This hasn't been documented yet - perhaps you are able to help us.
2 changes: 1 addition & 1 deletion docs/apis/plugintypes/qtype/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Question types have to do many things:
12. `renderer.php` - to display the key bits of this question types for the `core_question_renderer` to combine into the overall question display.
13. Implements Backup and restore, and all the other standard parts of a Moodle plugin like DB tables.
- [Restore code](restore.md) requires some special considerations to avoid question duplication.
14. Track [users preferences for the settings used for newly created questions](./qtype/newquestiondefaults).
14. Track [user preferences for the settings used for newly created questions](./qtype/newquestiondefaults).
4 changes: 2 additions & 2 deletions docs/apis/plugintypes/repository/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,13 @@ The File Picker uses Ajax calls to present the repository content. In order to i
- To retrieve the file that the user selected from a remote server, the plugin must rewrite the `get_file()` method.
- To provide search feature the plugin must rewrite the `search()` method.

All those methods are descrived below.
All those methods are described below.

### Functions you MUST override

These functions cover the basics of initialising your plugin each time the repository is accessed and listing the files available to the user from within the plugin.

#### __construct($respoitoryid, $context=SYSCONTEXTID, $options=array(), $readonly=0)
#### __construct($repositoryid, $context=SYSCONTEXTID, $options=array(), $readonly=0)

Should be overridden to do any initialisation required by the repository, including:

Expand Down
2 changes: 1 addition & 1 deletion docs/apis/plugintypes/theme/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ A placeholder is used within the CSS to allow use of a pix icon. During the CSS

:::note

Notice that the image file extension included. The reason for this leads us into the next topic, how to override images.
Notice that the image file extension is not included. The reason for this leads us into the next topic, how to override images.

:::

Expand Down
85 changes: 3 additions & 82 deletions docs/devupdate.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,10 @@
---
title: Moodle 5.1 developer update
title: Moodle 5.2 developer update
tags:
- Core development
- Moodle 5.1
- Moodle 5.2
---

<!-- markdownlint-disable no-inline-html -->

This page highlights the important changes that are coming in Moodle 5.1 for developers.

## Activity modules: now activities can define a secondary purpose

<Since version="5.1" issueNumber="MDL-85598" />

From now on, activity modules can define two different features in their `PLUGINNAME_supports` function:

- `FEATURE_MOD_PURPOSE`: This is the mandatory main activity purpose, and also the one that will determine the activity's icon color.
- `FEATURE_MOD_OTHERPURPOSE`: An optional secondary purpose to be used as an extra category in the activity chooser modal.

See the [Activity module support functions](./apis/plugintypes/mod#activity-module-support-functions) for further information.

## Code Structure

<Since version="5.1" issueNumber="MDL-83424" />

Most of the Moodle codebase, including all plugins, has been moved into a new `public` directory within the Moodle web root.

Most Moodle tooling has already been updated to support this, but minor web server reconfiguration will be required to support this.

See the [Restructure documentation](./guides/restructure/index.md) for further information on some of the changes required.

## Course format: activity chooser is now in core_courseformat

<Since version="5.1" issueNumber="MDL-85597" />
The activity chooser logic and templates have been relocated from `core_course` to `core_courseformat`. This change may impact themes that override the activity chooser rendering, but it also enables format plugins to provide custom outputs and templates for activity chooser elements, similar to other course content components. For details on how format can override outputs, see the [overriding output classes from course format plugin page](http://localhost:3000/docs/5.1/apis/plugintypes/format#override-output-classes).s

**How to check if your plugin is affected:**

For theme plugins, review whether any of the following templates are overridden:

- `core_course/activitychooser` (now in `core_courseformat/activitychooser`)
- `core_course/activitychooserbutton` (now in `core_courseformat/local/content/activitychooserbutton`)
- Any template in `core_course/local/activitychooser` (now in `core_courseformat/local/activitychooser`)

Additionally, renderer methods for loading the activity chooser have changed. Check if your format or theme overrides the following method:

- `core_course_renderer::course_activitychooser` (no longer used)

**What you need to do:**

- Move any overridden templates or AMD modules to their new locations in `core_courseformat`.
- Follow any deprecation notices for the activity chooser.

## Course format: activity chooser footer has been changed

<Since version="5.1" issueNumber="MDL-85597" />

The activity chooser UI now features a dedicated footer button for adding the selected activity to the course. The logic for managing the activity chooser footer has moved to `course/amd/src/local/activitychooser/dialogue.js`, which now controls the visibility of the back and add buttons based on the modal's content. This update may impact plugins that implement custom activity chooser footers.

**How to determine if your plugin is affected:**

- Check if your plugin provides a `custom_chooser_footer` implementation. You can do this by searching your plugin's `lib.php` for a function named `PLUGINTYPE_PLUGINNAME_custom_chooser_footer`.
- If your plugin implements this function, review your footer AMD module to see if it calls `modal.setFooter(...)`. To identify the AMD module, look at the first parameter passed when creating a new `core_course\local\entity\activity_chooser_footer` instance in your `custom_chooser_footer` function—this is the `$footerjspath`.

**What you need to do:**

- In most cases, simply remove the `modal.setFooter(...)` call from your AMD module, as the new activity chooser footer now manages this logic for you.
- For more advanced customizations, ensure you use the `course/templates/local/activitychooser/footer.mustache` template to render your custom footer content.

## Course format: max sections setting is now deprecated

<Since version="5.1" issueNumber="MDL-84291" />

The `maxsections` setting in course formats is now deprecated. Previously, this setting was used to limit the number of sections in a course. Starting with Moodle 5.1, courses can have an unlimited number of sections.

Although the `maxsections` setting remains available for now, it is marked as deprecated and will be removed in Moodle 6.0. Also, the `get_max_sections` from `core_courseformat\base` is also deprecated and will be removed in Moodle 6.0.

If your format plugin relies on `maxsections`, you should add a custom setting in your plugin to control section limits. For reference, see the week format plugin, which now uses its own setting for this functionality.

## Course format: new activity chooser rendering

<Since version="5.1" issueNumber="MDL-80295" />

The activity chooser in course formats has been refactored to use a new rendering approach. It now includes additional attributes such as `data-section-id` and `data-returnsectionid`, and the course renderer method for the activity chooser has changed.

This update primarily affects format plugins that customize section or activity card rendering. If your plugin calls `course_section_add_cm_control`, you should update it to use the new `section_add_cm_controls` method.

For themes that override activity chooser templates, ensure that the activity chooser button includes the required `data-section-id` and the `data-returnsectionid` attributes.
This page highlights the important changes that are coming in Moodle 5.2 for developers.
8 changes: 4 additions & 4 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: introduction
title: Introduction
description: Developer documentation for Moodle 5.1.
description: Developer documentation for Moodle 5.2.
slug: /
tags:
- Getting started
---

Welcome to the Developer Documentation for **Moodle 5.1**.
Welcome to the Developer Documentation for **Moodle 5.2**.

This documentation is version-specific and includes a range of useful guides and information.

Expand All @@ -17,10 +17,10 @@ This documentation is version-specific and includes a range of useful guides and
- Look through our [guides to Moodle APIs](./apis.md)
- Browse our [Moodle feature](./guides.md) deep dives
- Interested in supporting the Moodle App in your plugins? Read the [Moodle App documentation](/general/app)
{/*- You may want to read the [Release notes](/general/releases/5.1) for Moodle 5.1 */}
{/*- You may want to read the [Release notes](/general/releases/5.2) for Moodle 5.2 */}

:::

import ReleaseStateSummary from '@site/src/components/ReleaseStateSummary';

<ReleaseStateSummary releaseName="5.1" />
<ReleaseStateSummary releaseName="5.2" />
2 changes: 1 addition & 1 deletion nextVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
*/

const nextVersion = '5.1';
const nextVersion = '5.2';
const nextLTSVersion = '5.3';
const nextVersionRoot = `/docs/${nextVersion}`;

Expand Down
2 changes: 1 addition & 1 deletion static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@

# Issue #955
# Redirect /docs/* to /docs/[nextVersion]/:splat
/docs/* /docs/5.1/:splat
/docs/* /docs/5.2/:splat
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@
use moodle_page;

/**
* Basic renderer for pluginname format.
*
* @copyright 2022 Someone <someone@somewhere.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends section_renderer {
* Basic renderer for pluginname format.
*
* @copyright 2022 Someone <someone@somewhere.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends section_renderer {
// Override any necessary renderer method here.

/**
* Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
* @return string HTML to output.
*/
* Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title($section, $course) {
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section));
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section));
}

/**
* Generate the section title to be displayed on the section page, without a link.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param int|stdClass $course The course entry from DB
* @return string HTML to output.
*/
* Generate the section title to be displayed on the section page, without a link.
*
* This method is required to enable the inplace section title editor.
*
* @param section_info|stdClass $section The course_section entry from DB
* @param int|stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title_without_link($section, $course) {
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section, false));
}
return $this->render(format_base::instance($course)->inplace_editable_render_section_name($section, false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tags:

import { getExample } from '@site/src/moodleBridge';

The new course editor introduced n Moodle 4.0 reimplements most of the previous webservices, AMD modules, and internal logic of the course rendering. However, all formats since 3.11 will use the previous libraries by default until its final deprecation in Moodle 4.3. This document collects the main adaptations any 3.11 course format will require to continue working when this happens.
The new course editor introduced in Moodle 4.0 reimplements most of the previous webservices, AMD modules, and internal logic of the course rendering. However, all formats since 3.11 will use the previous libraries by default until its final deprecation in Moodle 4.3. This document collects the main adaptations any 3.11 course format will require to continue working when this happens.

## Changes summary

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tags:
documentationDraft: true
---

The `mod_fporum` activity can be extended using the `forumreport` sub-plugin type. This hasn't been documented yet - perhaps you are able to help us.
The `mod_forum` activity can be extended using the `forumreport` sub-plugin type. This hasn't been documented yet - perhaps you are able to help us.
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ The File Picker uses Ajax calls to present the repository content. In order to i
- To retrieve the file that the user selected from a remote server, the plugin must rewrite the `get_file()` method.
- To provide search feature the plugin must rewrite the `search()` method.

All those methods are descrived below.
All those methods are described below.

### Functions you MUST override

These functions cover the basics of initialising your plugin each time the repository is accessed and listing the files available to the user from within the plugin.

#### __construct($respoitoryid, $context=SYSCONTEXTID, $options=array(), $readonly=0)
#### __construct($repositoryid, $context=SYSCONTEXTID, $options=array(), $readonly=0)

Should be overridden to do any initialisation required by the repository, including:

Expand Down
Loading