-
Improvement
-
Resolution: Fixed
-
Critical
-
4.5
-
MOODLE_405_STABLE
-
MOODLE_405_STABLE
-
MDL-82715-main-rebased -
-
1
-
WP Sprint 2024-I3.3 (Espresso)
Following on from MDL-80858 and MDL-82571
Summary of changes
When configuring a number custom field allow administrator to choose whether they want to input the values manually for each course or calculate automatically. For course custom fields offer an option to calculate the "Number of activities in the course". For other custom field areas this option will not be available and the "Field type" selector should not be displayed. Add a hook to allow other plugins to add more options for automatically calculated fields.
When configuring a custom field
When the selector "Field type" is changed, all settings for the manual input disappear (using 'hideIf') and instead the settings for the selected field type appear.
In case of the "Number of activities in the course" the setting will be an autoselect allowing to choose activities of which types to count. Typical use case will be to display the number of assignments or quizzes (or similar assessment type activities).
Base class
All automatic types should inherit the base class. This base class should provide functions for:
- is_available() - type is available for the given field (i.e. it may only be available in specific areas, such as only courses or only cohorts)
- recalculate(?int $instanceid) - recalculates the values for all entities or only for a particular instance
The following functions will be called from the respective functions of the field_controller classes:
- config_form_definition()
- config_form_validation()
- get_default_value()
- prepare_field_for_display() - this has to be called from the function added in
MDL-82571, see last item in the requirements there
Scheduled task
There has to be a scheduled task that recalculates the values of all automatic fields.
When creating the course
When creating the course (or another entity that uses custom fields, i.e. a cohort), the field should be displayed with the empty value
When editing the course
When editing the course the field should be displayed in the correct position with the current value (formatted) and the button to update the value (it calls a WS).
The "Update" link and the web service are optional if we have enough time.
- caused a regression
-
MDL-83430 Callback from customfield_number provider is called too late when exporting value
- Closed
- has a non-specific relationship to
-
MDL-81196 Deprecate \core\hook interfaces in favour of attributes
- Open
- has been marked as being related by
-
MDL-80858 Add numeric field type for course custom fields
- Closed
- has to be done after
-
MDL-80858 Add numeric field type for course custom fields
- Closed
- is blocked by
-
MDL-82571 Add display format for the number-type custom field
- Closed