Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.11.11, 4.0.5, 4.1
-
None
-
MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
-
MDL-76723-311
Description
The read structure of an exporter does not produce the expected `required` field for optional formatted fields. The optional property of the formatted property is not applied to the format.
public static function define_properties() { |
return [ |
'content' => [ |
'type' => PARAM_RAW, |
'optional' => true, |
],
|
'contentformat' => [ |
'type' => PARAM_INT, |
'optional' => true, |
]
|
];
|
}
|
In the above example, the `contentformat` property will be marked as required. This is incorrect, it should be marked optional either from its own optional definition, or from its associated property.
Attached is a patch that demonstrates the issue, and offers a fix by referring to the parent property.