Add CCK/views formatter to output raw url path
jhedstrom - June 1, 2009 - 18:46
| Project: | Link |
| Version: | 6.x-2.6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
In order to use this field type in views to link other fields (using the very handy 'output this field as a link' feature), it is necessary to have a formatter that returns the raw path/url, rather than running it through the url function. (Without this formatter, the links are run through the url function twice, which results in absolute links for the form:
http://my/local/pathinstead of
http://{drupal}/my/local/pathThe attached patch adds this formatter.
| Attachment | Size |
|---|---|
| link.formatter.patch | 1.29 KB |

#1
I'd like to test this. Can you reroll the patch against the latest version (6.x-2.6)?
#2
Here's the reroll against the latest version.
#3
When I tried to apply the patch, all three hunks failed. It's entirely possible that this is user-error on my part -- I'm a complete novice to the patch process.
That said, when I made the changes to link.module manually, the code changes worked like a perfectly.
#4
Patch applies cleanly with the latest release:
@jess -- do:
$ patch -p0 < link.478922.patch
Will report back once I've actually tried it on a site :)
#5
Confirming this works.
You still need to run the data through link_cleanup_url(), in case users have entered "google.com" without a protocol. I'm doing this in my views template, but perhaps it would be nice to do this cleanup automatically? Would there be cases where that is not needed?
#6
Here's a rerolled patch that includes a quick call on link_cleanup_url() before returning the link.
#7
#8
You forgot to upload the patch
#9
Doh! Sorry X-)