That is, the string between the first occurence of '//' and the first occurence of '/' thereafter. The attached patch provides this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Boobaa’s picture

FileSize
608 bytes

Reworked the patch to be more simple and (hopefully) even a bit faster.

Boobaa’s picture

FileSize
622 bytes

Oh my goodness, seems like there are still folks out there who use php4... Patch updated accordingly.

alippai’s picture

Status: Needs review » Reviewed & tested by the community

checked this patch, 3 simple lines, works as expected

Boobaa’s picture

Version: 6.x-2.6 » 6.x-2.9
Status: Reviewed & tested by the community » Needs review
FileSize
622 bytes

Rerolled patch to make it cleanly apply to 6.x-2.9 (previous one had only offset warnings).

Boobaa’s picture

FileSize
650 bytes

Added some error handling as chx requested.

jcfiala’s picture

Assigned: Unassigned » jcfiala

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.)

chx’s picture

Status: Needs review » Reviewed & tested by the community
jcfiala’s picture

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. :)

Boobaa’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
3.25 KB

Here you are.

drifter’s picture

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?

Boobaa’s picture

FileSize
3.24 KB

Here it is.

drifter’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

ntg’s picture

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

jcfiala’s picture

Status: Reviewed & tested by the community » Fixed

Committed!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Boobaa’s picture

Version: 6.x-2.9 » 7.x-1.0
Category: feature » bug
Status: Closed (fixed) » Active

OK, looks like this functionality has been dropped from D7 version, but I can't find the reason. Why?

Boobaa’s picture

Status: Active » Needs review
FileSize
3.09 KB

Attached patch handles this in the way D7 link fields are dealt with: it provides a link_host field formatter (with tests).

jcfiala’s picture

Status: Needs review » Needs work

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.

Boobaa’s picture

Version: 7.x-1.0 » 7.x-1.1
FileSize
3.05 KB

Attached is the same as #17, but re-rolled against 7.x-1.1. I haven't worked on the token-based approach.

Boobaa’s picture

Version: 7.x-1.1 » 7.x-1.2
Issue summary: View changes
FileSize
3.08 KB

Attached the rerolled patch against 7.x-1.2. Still didn't manage to work on the token-based approach, though I like the idea.

Boobaa’s picture

Version: 7.x-1.2 » 7.x-1.3
FileSize
3.09 KB

Attached the rerolled patch against 7.x-1.3. No tokens yet. :S

jcfiala’s picture

Status: Needs work » Fixed

Okay, that's pretty basic and looks good - merged into 7.x-1.x, should show up in dev soon.

  • jcfiala committed 804cc94 on 7.x-1.x authored by Boobaa
    Issue #609560 by Boobaa: Provide token for hostname
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.