Skip to content

Commit 6ab86dd

Browse files
authored
Merge pull request #1162 from junpataleta/405fork
Fork documentation for Moodle 4.5
2 parents 154fe13 + 4fe3e3d commit 6ab86dd

File tree

293 files changed

+36774
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+36774
-265
lines changed

docs/devupdate.md

Lines changed: 3 additions & 264 deletions
Original file line numberDiff line numberDiff line change
@@ -1,271 +1,10 @@
11
---
2-
title: Moodle 4.5 developer update
2+
title: Moodle 5.0 developer update
33
tags:
44
- Core development
5-
- Moodle 4.5
5+
- Moodle 5.0
66
---
77

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

10-
This page highlights the important changes that are coming in Moodle 4.5 for developers.
11-
12-
## Badges
13-
14-
### Deprecated `badges/newbadge.php`
15-
16-
<Since version="4.5" issueNumber="MDL-43938" />
17-
18-
The `badges/newbadge.php` and `badges/edit.php` pages have been combined to make things easier to maintain since both were pretty similar (`newbadge.php` for creating badges and `edit.php` for editing them).
19-
20-
As a result, `badges/newbadge.php` is now deprecated and will be removed in Moodle 6.0. Please update your code to use `badges/edit.php` instead.
21-
22-
:::info
23-
24-
Visiting
25-
26-
https://yourmoodlesite/badges/newbadge.php?id=x
27-
28-
will now automatically redirect to
29-
30-
https://yourmoodlesite/badges/edit.php?courseid=x&mode=new
31-
32-
:::
33-
34-
### Deprecated `badges/view.php`
35-
36-
<Since version="4.5" issueNumber="MDL-82503" />
37-
38-
The `badges/index.php` and `badges/view.php` pages have been combined to make things easier to maintain since both were pretty similar and the workflow for accessing badges from the course page was confusing in some cases.
39-
40-
As a result, `badges/view.php` is now deprecated and will be removed in Moodle 6.0. Please update your code to use `badges/index.php` instead.
41-
42-
Apart from that, the `course_badges` system report has been merged with `badges` system report. It has been deprecated too and will be removed in Moodle 6.0. Please update your code to use `badges` system report instead.
43-
44-
:::info
45-
46-
Visiting
47-
48-
https://yourmoodlesite/badges/view.php?type=x&id=x
49-
50-
will now automatically redirect to
51-
52-
https://yourmoodlesite/badges/index.php?type=x&id=x
53-
54-
:::
55-
56-
## Core changes
57-
58-
### Autoloader
59-
60-
#### `ABORT_AFTER_CONFIG`
61-
62-
<Since version="4.5" issueNumber="MDL-80275" />
63-
64-
Prior to Moodle 4.5 only a small number of classes were compatible with scripts using the `ABORT_AFTER_CONFIG` constant.
65-
66-
MDL-80275 modifies the location of the class Autoloader in the Moodle bootstrap to make it available to scripts using the `ABORT_AFTER_CONFIG` constant.
67-
68-
:::note
69-
70-
Please note that the same limitations regarding access to the Database, Session, and similar resources still exist.
71-
72-
:::
73-
74-
#### Autoloading legacy classes
75-
76-
<Since version="4.5" issueNumber="MDL-81919" />
77-
78-
The Moodle class autoloader is now able to load legacy classes defined in the relevant `db/legacyclasses.php`. Files should only contain a single class.
79-
80-
```php title="Example entry in lib/db/legacyclasses.php"
81-
$legacyclasses = [
82-
// The legacy \moodle_exception class can be loaded from lib/classes/exception/moodle_exception.php.
83-
\moodle_exception::class => 'exception/moodle_exception.php',
84-
85-
// The legacy \cache class can be loaded from cache/classes/cache.php.
86-
\cache::class => [
87-
'core_cache',
88-
'cache.php',
89-
],
90-
];
91-
```
92-
93-
See MDL-81919 for further information on the rationale behind this change.
94-
95-
### SMS API
96-
97-
A new SMS API was introduced. See the [SMS API documentation](./apis/subsystems/sms/index.md) for more information.
98-
99-
## Course
100-
101-
### Reset course page
102-
103-
The reset course page has been improved. The words "Delete", and "Remove" have been removed from all options to make it easier to focus on the type of data to be removed and avoid inconsistencies and duplicated information.
104-
Third party plugins implementing reset methods might need to:
105-
106-
- Add static element in the `_reset_course_form_definition` method before all the options with the `Delete` string:
107-
108-
```php
109-
$mform->addElement('static', 'assigndelete', get_string('delete'));
110-
```
111-
112-
- Review all the strings used in the reset page to remove the `Delete` or `Remove` words from them.
113-
114-
:::caution
115-
116-
Starting from Moodle 4.5, the Reset course page form defined in the `_reset_course_form_definition` method should be reviewed because their options should not contain the `Delete` or `Remove` words.
117-
Check changes in any of the core plugins that implement the reset course method.
118-
119-
:::
120-
121-
## Deprecations
122-
123-
### Icon deprecation
124-
125-
<Since version="4.5" issueNumber="MDL-82212" />
126-
127-
A new mechanism for deprecating icons has been introduced. More information can be found in the [icon deprecation documentation](/general/development/policies/deprecation/icon-deprecation).
128-
129-
## Filter Plugins
130-
131-
<Since version="4.5" issueNumber="MDL-82427" />
132-
133-
Filter plugins and the Filter API have been updated to use the standard Moodle Class Autoloading infrastructure.
134-
135-
To ensure that your plugin continues to work in Moodle 4.5, you should move the `filter_[pluginname]` class located in `filter/[pluginname]/filter.php` to `filter/[pluginname]/classes/text_filter.php`, setting the namespace to `filter_[pluginname]` and renaming the class to `text_filter`.
136-
137-
:::tip Codebases supporting multiple versions of Moodle
138-
139-
If your codebase also supports Moodle 4.4 and earlier then you will also need to create a file in the 'old' location (`filter/[pluginname]/filter.php`) with the following content:
140-
141-
```php title="filter/[pluginname]/filter.php"
142-
class_alias(\filter_[pluginname]\text_filter::class, \filter_[pluginname]::class);
143-
```
144-
145-
This will ensure that the plugin class is available at both the old and new locations.
146-
147-
:::
148-
149-
## TinyMCE plugins
150-
151-
The `helplinktext` language string is no longer required by editor plugins, instead the `pluginname` will be used in the help dialogue
152-
153-
## Theme
154-
155-
### Context header
156-
157-
<Since version="4.5" issueNumber="MDL-82160" />
158-
159-
The method `core_renderer::render_context_header($contextheader)` has been deprecated, `core_renderer::render($contextheader)` should be used instead.
160-
161-
Plugins can still modify the context header by:
162-
163-
- Overriding `core_renderer::context_header()` method in their class extending `core_renderer`
164-
- Adding `core_renderer::render_context_header()` method to their class extending `core_renderer`
165-
- Overriding the `core/context_header.mustache` template
166-
167-
<Tabs>
168-
169-
<TabItem value="context_header" label="context_header()">
170-
171-
```php title="theme/example/classes/output/core_renderer.php"
172-
class core_renderer extends \core_renderer {
173-
[...]
174-
public function context_header($headerinfo = null, $headinglevel = 1): string {
175-
$output = parent::context_header($headerinfo, $headinglevel);
176-
return $output . '<div class="badge badge-info">Hi!</div>';
177-
}
178-
[...]
179-
}
180-
```
181-
182-
</TabItem>
183-
184-
<TabItem value="render_context_header" label="render_context_header()">
185-
186-
```php title="theme/example/classes/output/core_renderer.php"
187-
class core_renderer extends \core_renderer {
188-
[...]
189-
protected function render_context_header(\context_header $contextheader) {
190-
$context = $contextheader->export_for_template($this);
191-
$output = $this->render_from_template('core/context_header', $context);
192-
return $output . '<div class="badge badge-info">Hi!</div>';
193-
}
194-
[...]
195-
}
196-
```
197-
198-
</TabItem>
199-
200-
<TabItem value="template" label="Template">
201-
202-
```mustache title="theme/example/templates/core/context_header.mustache"
203-
{{!
204-
@template core/context_header
205-
206-
Template context_header
207-
208-
Example context (json):
209-
{
210-
}
211-
}}
212-
<div class="badge badge-info">Hi!</div>
213-
```
214-
215-
</TabItem>
216-
217-
</Tabs>
218-
219-
### Refactoring BS4 features dropped in BS5 using a "bridge"
220-
221-
<Since version="4.5" issueNumber="MDL-79917" />
222-
223-
Some of the Bootstrap 4 classes will be deprecated or dropped in its version 5. To prepare for this, some of the current Bootstrap 4 classes usages have been replaced with version 5 compatible classes using a "bridge". This will help us to upgrade to Bootstrap 5 in the future.
224-
225-
See more information in [Bootstrap 5 migration](./guides/bs5migration/index.md).
226-
227-
### Support FontAwesome families
228-
229-
<Since version="4.5" issueNumber="MDL-82210" />
230-
231-
Upon upgrading Font Awesome (FA) from version 4 to 6, the solid family was selected by default. However, FA6 includes additional families such as regular and brands. Support for these families has now been integrated, allowing icons defined with `icon_system::FONTAWESOME` to use them.
232-
Icons can add the FontAwesome family (`fa-regular`, `fa-brands`, `fa-solid`) near the icon name to display it using this styling:
233-
234-
```php title="Example of FA families from lib/classes/output/icon_system_fontawesome.php"
235-
'core:i/rss' => 'fa-rss',
236-
'core:i/rsssitelogo' => 'fa-graduation-cap',
237-
'core:i/scales' => 'fa-scale-balanced',
238-
'core:i/scheduled' => 'fa-regular fa-calendar-check',
239-
'core:i/search' => 'fa-magnifying-glass',
240-
'core:i/section' => 'fa-regular fa-rectangle-list',
241-
'core:i/sendmessage' => 'fa-regular fa-paper-plane',
242-
'core:i/settings' => 'fa-gear',
243-
'core:i/share' => 'fa-regular fa-share-from-square',
244-
'core:i/show' => 'fa-regular fa-eye-slash',
245-
'core:i/siteevent' => 'fa-solid fa-globe',
246-
247-
```
248-
249-
### FontAwesome icons updated
250-
251-
<Since version="4.5" issueNumber={"MDL-77537"} />
252-
253-
The icons in Moodle core have been updated according to the UX team's specifications in MDL-77754. The team reviewed and proposed updates to leverage the new icons in Font Awesome 6, ensuring greater consistency.
254-
255-
In addition to updating the icons, the following changes have been made:
256-
257-
- The SVG files have been updated to SVG FA6 for better alignment and improved appearance.
258-
- PNG, JPG, and GIF files have been removed from the repository where possible, leaving only SVG files to simplify maintenance.
259-
260-
For third-party plugins utilizing their own icons via the callback `get_fontawesome_icon_map()`, it is advisable to review and align these icons with the core icons for consistency. Here are some guidelines followed by the UX team that may be useful:
261-
262-
- The pencil icon has been replaced by a pen.
263-
- The cog icon is used exclusively for settings; otherwise, use the pen icon.
264-
- Import/Upload actions should use the `fa-upload` icon, while Export/Download actions should use the `fa-download` icon.
265-
- The eye icon is used for both visibility and preview actions.
266-
267-
:::tip Icons in Component library
268-
269-
On the Icons page of the [Component library](/general/development/tools/component-library), you can find a comprehensive list of all the icons available in Moodle core.
270-
271-
:::
10+
This page highlights the important changes that are coming in Moodle 5.0 for developers.

nextVersion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
const nextVersion = '4.5';
18+
const nextVersion = '5.0';
1919
const nextLTSVersion = '5.3';
2020
const nextVersionRoot = `/docs/${nextVersion}`;
2121

81.5 KB
Loading

0 commit comments

Comments
 (0)