I want to have an arrangement whereby I can switch off the default label in the cck display settings and have a default "intro" for each type that this field instance is used in, based on the settings per type. (I just noticed I can't do that, but I'll get round it - this problem actually occurs in global settings)

To that end, I configured a link field with link title set to "static", with a value of "More info: [field_link-view]". See http://dl.getdropbox.com/u/72790/static_tokens.png

My desired result would be something like: More info: <a href="some.gif">This is the link title</a>

This completely fails to work, however. What I actually get is this! http://dl.getdropbox.com/u/72790/static_tokens2.png - a link that's rendered with the name of the token as the title (token has failed to render) AND the text is rendered twice!

Comments

tim.plunkett’s picture

Title: Link module does not correctly process default text or tokens! » Link module does not correctly process default text or tokens
Version: 6.x-2.6-beta1 » 6.x-2.x-dev

I tried to set a static title to [title-raw], and it comes out as [title-raw]. I could have sworn it worked before, but I can't pinpoint when it stopped working or what changed.

Using link 6.x-2.x-dev and token 6.x-1.x-dev.

tim.plunkett’s picture

Component: Miscellaneous » Code
Status: Active » Needs review
StatusFileSize
new917 bytes

Found it! The culprit was the patch from #715682: Replace Tokens is forced in _link_sanitize(). $field['enable_tokens'] claims that it "will allow users to enter tokens in URLs and Titles on the node edit form" and that it "does not affect the field settings on this page", and yet Static titles won't work without enabling it.

Only the second half of that patch was correct. Here's a patch fixing the first half.

In every case, the token module needs to exist. But tokens should be processed in two scenarios: if the Static title is set, or if the Enable Tokens checkbox is checked.

Or, the Enable Tokens checkbox needs to state that for ANY tokens to be processed, it needs to be checked.

manuel garcia’s picture

Status: Needs review » Reviewed & tested by the community

Patch #2 applied fine, and is working as expected, in my configuration I have it setup to 'Static Title', and using the [title] token in it. Before the patch it would not substitute it for the node title, after the patch it works, also tested with other tokens to see.

catofcheshir’s picture

Version: 6.x-2.x-dev » 6.x-2.9

I lost my titles after upgrade to 2.9. Apply patch #2 manually - yes, it's work again!

tim.plunkett’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
cerup’s picture

Confirmed; Same problem here. #2 fixes it.

metastate’s picture

Upgraded to 6.x-2.9 and tokens stopped working. Patch in #2 fixed it.

haikubear’s picture

Can confirm bug in 6.x-2.9, Patch in #2 worked for me as well.

jcfiala’s picture

Title: Link module does not correctly process default text or tokens » "Allow User Entered Tokens" is required to be checked in order to enter tokens on the field settings page
Version: 6.x-2.x-dev » 6.x-2.9
Assigned: Unassigned » jcfiala

Agreed.

The problem here is that I made a change to how the admin-entered tokens are handled, and I didn't entirely think that through. This is a good patch, and I'll be applying it later.

I'm renaming this issues so I can point the other duplicate issues at this.

Thanks folks, and I apologize for screwing this up.

John Fiala

jcfiala’s picture

Title: "Allow User Entered Tokens" is required to be checked in order to enter tokens on the field settings page » "Allow User Entered Tokens" is required to be checked in order to enter tokens on the field settings page, but shouldn't be
Priority: Normal » Critical

amending the title, upping the priority so I don't miss this.

rkendall’s picture

Glad to see this is being looked at. I thought I was going going crazy there for a minute :-)

Not sure if the patch is working for me, I still need to check the "Allow user-entered tokens" box to have a token work in the "Link 'title' Attribute" text field. (I don't want to have 'user' entered tokens, just 'admin' entered tokens in the field definition).

Thanks.

jcfiala’s picture

It's entirely possibly that the patch does not cover all the locations where admin-entered tokens go, as opposed to the user-entered tokens go. I welcome a more comprehensive patch, but even if I don't get one I'll be sure to double-check my admin fields to make sure they all work with 'Allow user-enterted tokens' turned off.

Shai’s picture

I had the problem as described by many.

I applied the patch in #2.

It fixed the problem.

I'm really hoping that his patch can be committed very soon; at least to the dev version. I use Link on many sites and I don't want to have to apply the patch in each case. I just want to use drush to update.

Thanks for the great module.

Shai Gluskin

finex’s picture

subscribing

tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.79 KB

So it seems that $field['enable_tokens'] now is specifically for user-entered tokens, so all of the references to it had to be optional, or in the first case in the patch, removed altogether.

Please test!

tim.plunkett’s picture

StatusFileSize
new1.79 KB

Whoops, missing a parenthesis. Sorry!

Shai’s picture

I experienced the problem described here while using link-6.x-2.9

I applied the patch provided in comment #16

It applied cleanly

It fixed the problem

Shai Gluskin

dnewkerk’s picture

+1 on patch in #16. Tested and it works great :)

tim.plunkett’s picture

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

patch #16 works for me.

dboulet’s picture

Thanks for the patch, works well.

thill_’s picture

patch #16 works for me.

tim.plunkett’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
StatusFileSize
new1.77 KB

Rerolled after bangpound moved everything around :)

summit’s picture

Hi,

For me tokens are still not working, also not with this patch. Could it be that I have a panel for the node-form (panels overrides the original nodeform (www.drupal.org/project/panels)?
If you want me to make a new issue of this, I'll be happy to do this. Sorry then for this post.

EDIT: It is definetely a cck link <-> panels issue. Made a new issue: http://drupal.org/node/897330

Greetings, Martijn

xjm’s picture

#16 resolved the issue for me with 6.x-2.9.

obsidiandesign’s picture

+1 for the patch in #23 with 6.x-2.9.

daniel-san’s picture

+1 for the patch in #23 on 6.x-2.x-dev.

Extra feedback: Was trying to test on link-6.x-2.9, but the patch stopped because there was no link.inc file in the module folder.

tim.plunkett’s picture

@daniel-san, the patch in #16 is identical in functionality but applies to 6.x-2.9.

The patch in #23 still applies to 6.x-2.x!

tim.plunkett’s picture

The module is completely unusable for many use cases without this patch, which was posted 4 months ago, with a re-roll 2 months ago. Please commit this.

Sylvain_G’s picture

Subscribe

lucascaro’s picture

+1
patch #16 applied greatly to 2.9
thank you!

kiero63’s picture

Assigned: jcfiala » Unassigned

I still have a problem with the "Link 'title' Attribute". I use Link 2.9 et dev version, I apply patch but nothing works. In case i don't apply patch my tokens are visible as they were entered and after patch, I see nothing. Is possible that they a problem with others modules ?

Thanks

tim.plunkett’s picture

6 months of RTBC.

summit’s picture

Hi,
Yes +1 for committing patch.

greetings, Martijn

Shai’s picture

+1 for committing patch.

mfer’s picture

Status: Reviewed & tested by the community » Needs work

This patch needs some work. The module_exists() calls should be the last part of the if () statement. Checking a value in an array is much faster than making a call to module_exists. Even for the cases where everything inside module_exists is cached it's still slower. Performance matters.

dboulet’s picture

Status: Needs work » Needs review
StatusFileSize
new1.77 KB

New patch optimized as per #36.

carvalhar’s picture

hi,
i think this checkbox should be checked automatically if static is marked with token.
This is a better option for UX.

dboulet’s picture

@carvalhar, that could probably be dealt with in another issue, this is about fixing the bug.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Thanks mfer and dboulet.

carvalhar, please open a separate feature request for that, this is an actual bug.

James-TRMS’s picture

Thank you for this module - it could be fundamental to a significant functionality on one of my sites.

However, have applied patch #16 to 2.9 and works fine using Static Title with [field_myfieldname-url] for a single entry but when using "Add another item" the new item's url is correct but the title shown is the title from the first entry. Ditto the title attribute.

Am quite new to Drupal, CCK and this module am I missing something?

jcfiala’s picture

Status: Reviewed & tested by the community » Fixed

Okay, I've now committed this change - give a try with the new dev release that should roll out tonight and let me know.

fadgadget’s picture

dev release sorting this out nicely for me jc with no problems so far. thanks

romansta’s picture

Issue tags: +Date Repeat
StatusFileSize
new107.8 KB
new110.4 KB

If I use 'User Entered Tokens' in 2.9 or the dev-Version with this patch applied, the Repeat Rule of the Date-Module (6.x-2.7) is not showing anymore.

Sounds strange, but look at the screenshots.

Before you ask: I tested it also- unlike in the screenshot - without any other cck-fields on a fresh content type made with the date wizard.

Any ideas?

romansta’s picture

Status: Fixed » Needs work

Changed Status

ericm’s picture

latest dev release fixes the problem for me

vunger’s picture

Me too.

dqd’s picture

Priority: Critical » Normal
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -Date Repeat

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