-
Bug
-
Resolution: Fixed
-
Minor
-
3.11.11, 4.0.5, 4.1
-
2
-
Team Hedgehog 2023 Sprint 4.3, Team Hedgehog 2023 Review 4
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.