Skip to content
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

Create a FieldtypeURI to complement FieldtypeURL #529

Open
solonmedia opened this issue Jul 1, 2024 · 1 comment
Open

Create a FieldtypeURI to complement FieldtypeURL #529

solonmedia opened this issue Jul 1, 2024 · 1 comment

Comments

@solonmedia
Copy link

solonmedia commented Jul 1, 2024

Short description of the enhancement

It would be great to add a URI fieldtype to core to allow for easier manipulation of protocols outside those typically parsed by parse_url.

There is a library that extends and enhances parse_url into a parse_uri method that seems to be a drop-in replacement for parse_url but would extend the options to include a facility to parse additional protocols.

https://github.com/peterpostmann/php-parse_uri

Current vs. suggested behavior

Right now if you are using a protocol link URI that parse_url does not understand, an error will be thrown using the FieldtypeURL.

An example of this would be the sms: protocol which works similar to the tel: protocol but pushes a request to open a messaging app rather than the phone app. This currently fails with FieldtypeURL

Extending this to include URI or have an optional URI Fieldtype with additional security features would be useful.

@solonmedia solonmedia changed the title Create a FieldtypeURI to complement FieltypeURL Create a FieldtypeURI to complement FieldtypeURL Jul 1, 2024
@ryancramerdesign
Copy link
Member

@solonmedia Sounds like a good idea, though I'm not sure the need is common enough to require a full Fieldtype/Inputfield just for this purpose. What about using the "text" field with the "pattern" setting? If server-side validation was also needed in the application, a hook after the Inputfield's processInput() method could use that library you mentioned. All of this could be bundled into a non-core URI Fieldtype/Inputfield module for when the need comes up, or maybe just the Inputfield.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants