Document singleton pattern changes in customfields handler. - #1661
Open
paulholden wants to merge 1 commit into
Open
Document singleton pattern changes in customfields handler.#1661paulholden wants to merge 1 commit into
paulholden wants to merge 1 commit into
Conversation
✅ Deploy Preview for moodledevdocs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
Documents the change in Moodle 5.2 that moves \core_customfield\handler::create(...) static caching/reset behavior into the base handler, and updates the Custom fields API docs accordingly.
Changes:
- Added a Moodle 5.2 developer update entry describing the base handler
create()caching/reset change (MDL-88176). - Updated Custom fields API documentation (current + 5.2) to reflect the base handler’s
create()behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| versioned_docs/version-5.2/devupdate.md | Adds a 5.2 dev update note about the base customfields handler create() caching/reset change. |
| versioned_docs/version-5.2/apis/core/customfields/index.md | Updates the 5.2 Custom fields API docs to describe the base handler create() behavior. |
| docs/apis/core/customfields/index.md | Updates the current Custom fields API docs to describe the base handler create() behavior. |
Comment on lines
+42
to
+43
| The base `\core_customfield\handler::create(...)` method now implements static caching/reset itself, so all implementation of the same from extending | ||
| classes should be removed. |
| Component/plugin that uses custom fields must define a **handler class** for each area and a **configuration page**. Handler class must be called `<PLUGINNAME>/customfield/<AREA>_handler` and be placed in autoloaded location `<PLUGINDIR>/classes/customfield/<AREA>_handler.php`. This class must extend **\core_customfield\handler** . Configuration page may be located anywhere. For course custom fields configuration the admin settings page is used [/course/customfield.php](https://github.com/moodle/moodle/blob/main/course/customfield.php). If the area uses `itemid` this page should take `itemid` as a parameter. | ||
|
|
||
| Handler has protected constructor, to get a handler call `create()` method. Some areas may choose to return a singleton here: | ||
| Handler has protected constructor, to get a handler call `create()` method. The base class implementation returns a singleton here: |
| Component/plugin that uses custom fields must define a **handler class** for each area and a **configuration page**. Handler class must be called `<PLUGINNAME>/customfield/<AREA>_handler` and be placed in autoloaded location `<PLUGINDIR>/classes/customfield/<AREA>_handler.php`. This class must extend **\core_customfield\handler** . Configuration page may be located anywhere. For course custom fields configuration the admin settings page is used [/course/customfield.php](https://github.com/moodle/moodle/blob/main/course/customfield.php). If the area uses `itemid` this page should take `itemid` as a parameter. | ||
|
|
||
| Handler has protected constructor, to get a handler call `create()` method. Some areas may choose to return a singleton here: | ||
| Handler has protected constructor, to get a handler call `create()` method. The base class implementation returns a singleton here: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See MDL-88176.