Let plugins define custom regform field types#5282
Merged
ThiefMaster merged 2 commits intoindico:masterfrom Mar 10, 2022
Merged
Let plugins define custom regform field types#5282ThiefMaster merged 2 commits intoindico:masterfrom
ThiefMaster merged 2 commits intoindico:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Considering that this will most likely be a niche feature, I didn't spend a lot of time gracefully failing cases where a registration form contains a field but doesn't have the corresponding plugin; accessing such a form will simply fail with an error.
There's no special handling for fields containing files right now, I hope that someone who adds e.g. a passport photo field will eventually see how well this is possible and if there's a need for additional signals or calling methods of the field class instead of hardcoded logic...Nevermind, found an easy solution to cover this.In case someone who sees this PR wants to see how a custom field would be defined, here's the diff of what I used to test (yes, I was lazy and just added it to the one plugin that already uses regform-related extension points ;)): pluginfield.diff.txt