-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEW Add UrlField #11116
NEW Add UrlField #11116
Conversation
dd16dd3
to
071fa85
Compare
@GuySartorelli Since parse_url() doesn't actually validate the url, and symfony/validator was just weird (uses attributes) I've switched back to using filter_var() for the actual validation. It works fine, unit tests pass which include underscores and parenthesis in tests |
2223cde
to
4c975d4
Compare
Assuming you approve and merge #11123, please use |
4c975d4
to
2e4bc95
Compare
Good addition. Have you thought about supporting other URI schemas, not just http(s)? There are other schemas such as mailto, tel, sftp, git+ssh, protocol-less URLs are also valid starting with //, so I think this is currently underdelivering and if people wanted to use it for other URLs than just web URLs then they would need to resort to plain text fields again and won't benefit from the new field. For reference e.g. https://en.wikipedia.org/wiki/List_of_URI_schemes and https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Example_URIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Have you thought about supporting other URI schemas, not just http(s)?
For now this is only intended to support external http(s) URLs - we were originally going to add this directly to the linkfield module (see the associated issue), but decided if it's in core it can be used more widely (within the bounds of its intended purpose).
More schemes could be added in the future, but that would require additional validation logic which means more dev time to (at a minimum) find a library or constraint which handles that validation correctly - which just isn't in scope right now for the work we're doing.
Issue silverstripe/silverstripe-linkfield#17