-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
-
2.0
-
None
-
MOODLE_20_STABLE
This proposal is intended to provide extra hooks allowing add-on modules to do things which are currently hard-coded so that the built-in modules (only!) can do them. See original forum discussion http://moodle.org/mod/forum/discuss.php?d=152085 for earlier discussion.
There is a function plugin_get_coursemodule_info. At the moment this is permitted to return an object with a list of return information:
- extra - in the case of label , this appears as text instead of the normal link. In the case of everything other than label , this can be used to put extra attributes inside the <a> or <span> tag for the line (but not the class attribute because that might be set already).
By the way, this API is appalling.
- icon , iconcomponent - change or set the icon for the component
- name - change or set the name for the component
This information is used in print_section. It may also be accessed in other places that use get_fast_modinfo .
My suggestion has two parts.
1 Provide extra features for use in print_section
- Add an extraclasses variable (which can be used so that modules can customise some of their links with additional classes/styling).
- Leave extra defined as it is for modules other than label (retaining backward compatibility), but remove the special-case for label .
- Add a url parameter which, if set (to a moodle_url (or string?), customises the link. If you set it to null that means there is no link.
By a combination of the url parameter (=null) and the existing name parameter (=label content), it should be possible to change the implementation of label so that it does not require any hack in print_section.
2 Provide extra generic feature to enable other uses by plugins
At present only named parameters are permitted from plugin_get_coursemodule_info and these have defined meanings. Frequently it is useful if plugins (and, though not recommended, modifications to core code) can add other information that should be cached. This should be possible without having to change the core code.
- Add an optional options parameter which is a Moodle-style undefined object. If specified, this may include any number of parameters which will all be serialised into modinfo and returned by get_fast_modinfo.