Details
-
Improvement
-
Resolution: Won't Fix
-
Major
-
None
-
2.6.1
Description
At the moment Moodle has plenty of little APIs (consisting of one-two functions each) that require plugins to define PLUGINNAME_CALLBACKNAME() functions in their lib.php files.
Examples:
- xxx_print_recent_activity
- xxx_get_recent_mod_activity
- xxx_reset_course_form_definition
- xxx_comment_display
- xxx_grade_item_update
- xxx_add_istance_hook
- xxx_restore_group_member
- xxx_restore_group_assignment
- xxx_delete_instance
- xxx_delete_course
- xxx_supports
... (and so on, just grep by "component_callback" or "function_exists" )
There are several problems with this approach:
- bad documentation, hard to know about all various existing callbacks
- easy to confuse the arguments because there is no interface
- necessary to include all lib.php files (which are sometimes huge) to find handful of plugins implementing functions - SLOW!
- limiting implementation to one plugin type because otherwise it's too expensive to look for callbacks
Suggested approach that was discussed on backend meetings, especially with skodak is to use hooks and class autoloading.
There is no goal to convert all existing APIs into the new format ASAP but will be nice to gradually do it, slowly deprecating old-style callbacks.
There are at least two issues that would benefit from the agreement on standard:
MDL-43742converting recent activity callbacks (atm we need to implement two very similar callbacks in each module)- MDL-24359 extending course reset callbacks to other plugin types (i.e. blocks)
Forum post: https://moodle.org/mod/forum/discuss.php?d=254508
Attachments
Issue Links
- blocks
-
MDL-43742 Create API for recent activity
-
- Closed
-
-
MDL-53978 Add extra plugin callbacks for every major stage of page render + swap user tours to use them
-
- Closed
-
- has a non-specific relationship to
-
MDL-28030 Add config.php settings to allow plugins to rewrite output moodle_urls (eg clean / semantic urls)
-
- Closed
-
-
MDL-43966 Write transition guide for events and logging
-
- Closed
-
-
MDL-74954 Hooks as replacement for some one-to-many lib.php callbacks based on PSR-14
-
- Closed
-
-
MDL-44307 Add require_plugin method to test that a plugin is installed and has a required version
-
- Closed
-
-
MDL-51396 allow flexibility of core_component by using static:: instead of self::
-
- Closed
-
- has been marked as being related by
-
MDL-24359 Reset Course does not clear block data
-
- Development in progress
-
-
MDL-50645 Cache the list of available callbacks per plugin
-
- Closed
-
-
MDL-43803 Let moodle recordset accept a callback for transforming data
-
- Closed
-
-
MDL-46155 Core method to retrieve list of classes
-
- Closed
-
-
MDL-53978 Add extra plugin callbacks for every major stage of page render + swap user tours to use them
-
- Closed
-
- Testing discovered
-
MDL-57702 IMSEnterprise has broken callback
-
- Closed
-
- will help resolve
-
MDL-48012 Integrate the 'local_recyclebin' plugin into core
-
- Closed
-
-
MDL-51867 Allow any plugin to identify a scale as being used
-
- Closed
-
-
MDL-39709 The ability to edit a cohort to attach courses to it
-
- Closed
-
-
MDL-44678 Call plagiarism plugins when running reset_course_userdata()
-
- Closed
-
-
MDL-46611 Course reset features for local plugins
-
- Closed
-