-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.1
-
MOODLE_401_STABLE
-
2
The current mod_data depends on a method called data_get_field which can be replaced by the new $manager->get_field.
The data_get_field is used in many places inside the module but the current implementation has some flaws that can be avoided using the new one. For example, data_get_field does not check for the field.class.php file existence before including it, producing an exception that leaves the activity instance unusable if the field plugin is removed without uninstalling. Another example is that the method returns a false if the instance cannot be created, producing unexpected results in the instance if it is not present.
This issue will require:
- Refactor all uses of data_get_field to generate a manager instance and call manager->get_field
- When possible, deprecate the parent method and create a new one using the manager as a first param (or add it as a manager method).
- Refactor data_get_field_from_nam, data_get_field_from_id and data_get_field_new to use $manager->get_field. Those methods will also be deprecated later on a follow-up issue that should be created when this issue is ready.
- Because manager:get_field always returns a valid field (a data_field_base if the field is not present on disk) we need to alter the data_field_base print methods (display_browse_field, display_edit_field, display_add_field) to show a warning if the get_class($this) is equals to data_field_base.
- Discovered while testing
-
MDL-75414 Some field types, like images or URL, are not rendered correctly on Single view for Database activity
-
- Closed
-