Skip to content
Closed
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
  •  
  •  
  •  
43 changes: 2 additions & 41 deletions docs/devupdate.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,6 @@
---
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.

## 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: 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.
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 general/releases/5.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ReleaseNoteIntro } from '@site/src/components/ReleaseInformation';

<ReleaseNoteIntro releaseName={frontMatter.moodleVersion} />

If you are upgrading from a previous version, please see [Upgrading](https://docs.moodle.org/en/Upgrading) in the user docs.
If you are upgrading from a previous version, please see [Upgrading](https://docs.moodle.org/501/en/Upgrading) in the user docs.

## Server requirements

Expand Down
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions versioned_docs/version-5.1/_utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/**
* Copyright (c) Moodle Pty Ltd.
*
* Moodle is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Moodle is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { type ReactNode } from 'react';
import ComponentFileSummaryGeneric, {
type ComponentFileSummaryProps,
} from '@site/src/components/ComponentFileSummary';
import { MDXProvider } from '@mdx-js/react';

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

export {
getExample,
ComponentFileSummaryProps,
};

/**
* Fill the default properties.
* @param {Props} props
* @return {Props}
*/
export const fillDefaultProps = (props: ComponentFileSummaryProps): ComponentFileSummaryProps => ({
filetype: 'php',
examplePurpose: props.summary,
...props,
});

const normaliseDescription = (Value: ReactNode | string): null | JSX.Element => {
if (typeof Value === 'boolean' || !Value) {
return null;
}

if (typeof Value === 'string' || React.isValidElement(Value)) {
return (
<MDXProvider>
{Value}
</MDXProvider>
);
}

return (
<MDXProvider>
<Value />
</MDXProvider>
);
};

/**
* Get the preferred description given a standard properties value which contains an optional description,
* and/or extraDescription, and a DefaultDescription object.
*
* @param {Props} props
* @param {DefaultDescription} DefaultDescription The default description to use if the `description` property is empty
* @returns {MDXLayout}
*/
export const getDescription = ({
description = null,
extraDescription = null,
children = null,
}: ComponentFileSummaryProps, defaultDescription?: ReactNode | string): null | ReactNode | JSX.Element => {
if (children) {
const Description = normaliseDescription(children);
return (
<MDXProvider>
{Description}
</MDXProvider>
);
}

if (description) {
const Description = normaliseDescription(description);
return (
<MDXProvider>
{Description}
</MDXProvider>
);
}

const Description = normaliseDescription(defaultDescription);
const ExtraDescription = normaliseDescription(extraDescription);

if (Description) {
return (
<MDXProvider>
{Description}
{ExtraDescription}
</MDXProvider>
);
}

return null;
};

export const ComponentFileSummary = (initialProps: ComponentFileSummaryProps): JSX.Element => {
const props = fillDefaultProps({
examplePurpose: initialProps?.summary ?? null,
...initialProps,
});

props.description = getDescription(props, props?.defaultDescription ?? null);

if (props?.example || props?.defaultExample) {
props.example = getExample(props, props?.defaultExample ?? null);
}

return ComponentFileSummaryGeneric(props);
};
Loading