In order to fix #103680: Path alias validation should test for full URLs I want to add an URL element that allows developers to create text fields that accept absolute URLs, URL paths or URL aliases or a combination of these three.
What this patch should fix, directly or indirectly:
- Automatically removed leading and trailing slashes from URL paths and URL aliases (UX problem and bug).
- Centralised validation for different kinds of URLs, which makes code easier and fixes numerous bugs.
- One element that can accept different kind of URLs. It is possible with textfields, but that's not as clean.
For this menu_valid_path() needs to be split in a function that checks if a URL path is actually valid (like the name suggests) and a function that does an access check. Path_admin_form_validate() and path_form_element_validate() also need to be changed to provide one URL alias validation function. Both new validation functions should simply return a boolean.
This approach would fix numerous issues across Drupal. It does not really change the API, but it rather extends it.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 624812-url-field.patch | 7.07 KB | bleen |
Comments
Comment #1
seutje commented<font size="friggin huge">+</font> (a friggin huge +)
I think this would make a lot of lives way easier and result in a big reduction in killed kittens
Comment #2
bleen commentedAs much as I like this idea ... I think it's a new feature and therefor -> D8
Comment #3
bleen commentedEDIT: Ignore this ... I meant this for a completely different issue
Comment #4
bleen commentedComment #5
xanoWell, it would be great if we could add a URL form element and use that for the field widget instead of duplicating the functionality.
Comment #6
bleen commentedIsn't this issue covered by #1174630: Add new HTML5 FAPI element: url
Duplicate?
Comment #7
xanoDuplicate of #1174630: Add new HTML5 FAPI element: url.