Skip to content

Commit

Permalink
[docs] Remove registration changes
Browse files Browse the repository at this point in the history
We were able to deprecate the modal_factory entirely in 4.3, so for new
code aimed at 4.3 onwards, there is no need to register. The new
registration process is only available for 4.3 onwards, so it no longer
makes sense to document this.

Code aimed at versions including 4.2 and older will still need to
register using the previous mechanism.
  • Loading branch information
andrewnicols committed Sep 12, 2023
1 parent b0d82d4 commit c56f736
Showing 1 changed file with 0 additions and 62 deletions.
62 changes: 0 additions & 62 deletions docs/devupdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,68 +353,6 @@ MyModal.create({
</TabItem>
</Tabs>

### Registration helper

<Since version="4.3" issueNumber="MDL-78306" />

Moodle 4.3 introduces a new `registerModalType` method on the Modal class to aid in registering a modal.

:::note Compatibility with Moodle 4.2 and older

If your code is intended to work with Moodle 4.2 and older, then you must continue to use the old method of registration. This legacy method will be maintained until Moodle 4.6.

:::

<Tabs groupId="beforeAfter">
<TabItem value="before" label="Before Moodle 4.3">

<InvalidExample
title="A modal using the legacy registration approach"
>
The legacy registration will continue to work and should be used if your plugin will be used in Moodle 4.2, or earlier.

```js
var MyModal = function(root) {
Modal.call(this, root);
};

MyModal.TYPE = 'mod_example/myModal';
MyModal.prototype = Object.create(Modal.prototype);
MyModal.prototype.constructor = MyModal;

let registered = false;
if (!registered) {
ModalRegistry.register(MyModal.TYPE, MyModal, 'mod_example/my_modal');
registered = true;
}

return MyModal;
```

</InvalidExample>
</TabItem>

<TabItem value="after" label="From Moodle 4.3 onwards" default>
<ValidExample
title="A modal using the new shortcut helper"
>
The shortcut helper for Modal registration is suitable for Moodle 4.3 onwards.

```js
export default class MyModal extends Modal {
static TYPE = 'mod_example/myModal';
static TEMPLATE = 'mod_example/my_modal';
}

MyModal.registerModalType();
```

</ValidExample>
</TabItem>
</Tabs>

## Forms API

### add_sticky_action_buttons
Expand Down

0 comments on commit c56f736

Please sign in to comment.