[4.3] Fix SQL custom field default value validation #39355
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue #29565.
Summary of Changes
Some of our List base custom fields like SQL uses
OptionsRule
https://github.com/joomla/joomla-cms/blob/4.2-dev/libraries/src/Form/Rule/OptionsRule.php to validate it's data. This rule requires a valid$form
object to validate data in case the options for the field not defined in XML but dynamic defined (for example, from database) viagetOptions
method of the field typeThis PR changes logic of
checkDefaultValue
method inFieldModel
class to handle default value properly for these kind of custom fields. It is a bug fix, but I decided to implement the change to 4.3 branch so that we have more time for reviewing and testing the change. I also includes the change from PR #39354 (for 4.2 branch) so to avoid merge conflict.Ping @laoneo for checking this change.
Testing Instructions
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed