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/path

instead of

http://{drupal}/my/local/path

The attached patch adds this formatter.

AttachmentSize
link.formatter.patch1.29 KB

#1

jesss - July 9, 2009 - 16:04

I'd like to test this. Can you reroll the patch against the latest version (6.x-2.6)?

#2

jhedstrom - July 21, 2009 - 21:31

Here's the reroll against the latest version.

AttachmentSize
link.478922.patch 1.29 KB

#3

jesss - July 31, 2009 - 14:07

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

joachim - August 19, 2009 - 10:27

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

joachim - August 20, 2009 - 14:29

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

DamienMcKenna - October 26, 2009 - 17:59
Version:6.x-2.6-beta1» 6.x-2.6
Status:needs review» patch (to be ported)

Here's a rerolled patch that includes a quick call on link_cleanup_url() before returning the link.

#7

DamienMcKenna - October 26, 2009 - 17:59
Status:patch (to be ported)» needs review

#8

crea - November 2, 2009 - 15:00

You forgot to upload the patch

#9

DamienMcKenna - November 2, 2009 - 15:32

Doh! Sorry X-)

AttachmentSize
link-n478922-v2.patch 1.47 KB
 
 

Drupal is a registered trademark of Dries Buytaert.