Posted by Boobaa on October 20, 2009 at 3:26pm
7 followers
| Project: | Link |
| Version: | 7.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | jcfiala |
| Status: | needs work |
Issue Summary
That is, the string between the first occurence of '//' and the first occurence of '/' thereafter. The attached patch provides this.
| Attachment | Size |
|---|---|
| link-host.patch | 673 bytes |
Comments
#1
Reworked the patch to be more simple and (hopefully) even a bit faster.
#2
Oh my goodness, seems like there are still folks out there who use php4... Patch updated accordingly.
#3
checked this patch, 3 simple lines, works as expected
#4
Rerolled patch to make it cleanly apply to 6.x-2.9 (previous one had only offset warnings).
#5
Added some error handling as chx requested.
#6
Hey, keen!
I'm assigning to myself so I'll find an incorporate it the next time I'm adding code to the Link module. (There's really quite a lot of tickets, and it's easy to lose them.)
#7
#8
Coolness - I see chx approves.
I'll be including it either way, but for bonus love from me, create a simpletest test that shows that your token works!
(Of course, you may not want bonus love from me. :)
#9
Here you are.
#10
Downloaded the patch, created a link field containing the token, ran the simpletests - all went as expected. Maybe rename the test from testUserTokenLinkCreate2 to something more descriptive, like testHostTokenLinkCreate?
#11
Here it is.
#12
Looks good
#13
Hello,
Thank you very much for this patch. It worked perfectly but I was wondering if it is possible to remove also the "www" and "com", "net" etc part of the hostname.
Thank you in advance for your help.
Nik
#14
Committed!
#15
Automatically closed -- issue fixed for 2 weeks with no activity.
#16
OK, looks like this functionality has been dropped from D7 version, but I can't find the reason. Why?
#17
Attached patch handles this in the way D7 link fields are dealt with: it provides a link_host field formatter (with tests).
#18
Wow, so, I'm looking through the code for tokens, and it's pretty complex over there. Lots of things to climb through and figure out, but I think I've finally got a handle on it.
Is this the way that other fields are handling variant token outputs? It almost seems to me that we should be trying to hook into the various url detail/chain fields that the token module produces, although I'll admit I"m not entirely sure how to handle that yet. Then someone could do something like [node:field_link:host] and get the host, or [node:field_link:path] and just get the path.
But I'm up for hearing discussion on this.
#19
Attached is the same as #17, but re-rolled against 7.x-1.1. I haven't worked on the token-based approach.