Closed (fixed)
Project:
Link
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Mar 2011 at 18:44 UTC
Updated:
4 Jul 2016 at 12:43 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tonycpsu commentedSubscribing
Comment #2
esculcar commentedSubscribing
Comment #3
jastraat commentedI believe all that needs to be done is replace link_token_list() and link_token_values() with the following:
(Note: this assumes that the patch from http://drupal.org/node/691078 gets into the token module)
Comment #4
decipheredPatch attached with my version of Token support, which is basically the same but with an extra 'view' token for a simple formatted link.
Comment #5
Everett Zufelt commentedI didn't read through the patch, but I did apply it.
I expected to be able to use:
[node:field-name:title]
[node:field-name:url]
or at the least
[node:field-name:value]
None of these supplied me with a valid token.
Comment #6
decipheredEverett,
They worked fine for me, have you applied the Token module Field Tokens issue patch (http://drupal.org/node/691078?page=1#comment-4594082)?
Cheers,
Deciphered.
Comment #7
dalinI too do not see any tokens available for link fields. I'm using Entity API module rather than the core patch. I do see tokens for other field types.
Comment #8
decipheredDalin,
I don't know about any core patch, but you do require the Token module and Token module patch.
Maybe try that.
Comment #9
Everett Zufelt commented@dalin
I am using token 7.x-1.x with the field tokens patch applied. I can access tokens for some of the other fields on my node, but not the link field.
If I go to node/1/devel/token the field is listed as
[node:field-name-of-link-field
But, I don't seem to be able to access anything from that token with :value], :title] or :url]
Comment #10
jastraat commentedHey Everett,
While the dev module doesn't display the expanded set of tokens, they do exist. If you are using auto nodetitle or pathautho, you should see the expanded set in those places.
Comment #11
Everett Zufelt commentedWhere do I find the token list with the auto_nodetitle module? When I edit the content-type and the auto nodetitle tab is active I don't see anything that would indicate a list of tokens.
note: I am using a screen-reader, so it is possible that this feature of auto nodetitle is not accessible, I can file a bug against that module if this is the case.
Comment #12
Everett Zufelt commentedCrazy, I just looked again and they are there. Thanks for the heads up.
Comment #13
jastraat commentedno problem :)
Comment #14
jastraat commentedComment #15
dalinI get the tokens now with that patch to Token module. Odd that I didn't need that to use tokens for other field types.
I think Token module isn't doing enough cache clearing.
This patch works for me, though I didn't do a technical review so I won't mark it RTBC.
Comment #16
dalinOh this was already RTBC, so I'll return it to that.
Comment #17
dqdComment #18
justmagicmaria commentedI am using Token 7.x-1.0-beta7 and the Link 7.x-1.x-dev from Oct. 28. I see the field token but it does not have the tokens for the title or url components. I have cleared the cache after upgrading. (The Token patch referred to in an earlier comment no longer works with the current Token module.) Has anyone tried this with the latest and had it work?
Comment #19
hibersh commentedhttp://drupalcode.org/project/link.git/blob/refs/heads/7.x-1.x:/link.module
patch not committed yet
Comment #20
hibersh commentedpatch not working
Comment #21
hackwater commentedLooks like we've got a couple of options: wait for the Token module to resolve its architectural issues (see #691078: Field tokens) or try to get this done via the Entity API module's Entity Tokens module, which may have its own challenges. As it happens, the Date module is facing similar issues; there's a currently postponed issue over there summarizing the challenges (see #1103032: Document how to use date tokens).
I haven't tried Link fields with the Entity Tokens enabled yet; I did try to see how far I could get with core Token functionality and the Token module enabled, using the Examples module, the code in comment #3 above, and the Date module's tokens.inc as a template, but it doesn't look like I'll have any more success than the rest of you given the issues I cited.
Comment #22
yannickooYou can access the link title and url via the entity token module which is included in the Entity API module.
Comment #23
jastraat commentedPathauto unfortunately requires the token module, and the token module + entity api tokens do not play nice together.
Comment #24
yannickooWhat do you mean exactly? It works fine for me.
Comment #25
jastraat commentedhttp://drupal.org/node/1272560
Comment #26
mgifford@jastraat what about #1272560: Entity tokens duplicates field tokens created by token module ?
@hackwater I don't think there's a need to wait till the issues you highlighted in #21 are fixed. Others modules aren't.
There's even a patch from @Deciphered, thought it needs review.
I expect what was needed #691078: Field tokens is available in Token 7.x-1.4.
Comment #27
jastraat commented@mgifford - The duplication of all tokens doubles the number of tokens that the token UI has to handle and leads to a memory problem: http://drupal.org/node/1203018
Comment #28
spencerthayer commentedSubscribing
Comment #29
letrotteur commentedAnything new regardind this issue? using token 1.5 and link 1.1 doesn't seem to provide token for the title or url.
Comment #30
axe312 commentedThis is still not working.
Any updates on this problem? I tried to apply the patch from #4 manually, but the tokens are replaced by "". (I also needed to enable entity_token module)
Comment #31
jcfiala commentedSo, looking at #1103032: Document how to use date tokens, it seems the Date module doesn't have field token support either.
This seems to be due to some kind of strange technical problem that the folks in charge of Token haven't worked out yet.
I'm willing to see another possible patch, but for the moment this issue seems stalled on problems elsewhere.
Comment #32
heddnI'm going to go out on a limb here and suggest that the entity api integration provided by property_callbacks => link_field_property_info_callback and entity tokens provides this functionality. With that in mind, marking this fixed.
Entity api's tokens provide tokens for each of the defined items in link_field_item_property_info().
Comment #34
Road Kill commentedSo what is the status here is it possible to use tokens in field link or not?