Custom wrappers with link to content for teaser display modes is brilliant! When I tried to use them with tokens I get the below output and the link, of course, doesn't work:

onclick="location.href='/%5Bnode%3Afield_link%5D'"

Add link
[token]
This will add an onclick attribute on the layout wrapper.

Custom link
[node:field_link]
You may use tokens for this link if you selected tokens.

Browse available tokens.

CommentFileSizeAuthor
#4 Screen Shot 2016-12-19 at 16.42.31.png85.01 KBRAWDESK

Comments

greg boggs’s picture

Status: Active » Closed (works as designed)

If you get tokens printed out, it means that you typoed the token.

Example:
This first one will work:
[node:field-link:url]

will print:
onclick="location.href='http://google.com'"

These two will print garbage to the onclick:
[node:field_link]

will print:
onclick="location.href='"

[node:field_link:url]

will print:
onclick="location.href=[node:field_link:url]"

PI_Ron’s picture

I've tried:

[node:field_link:url]

and

[node:field-link:url]

Both produce garbage, only [node:field_link] produces data, but it is a complete link sanitised. I can't figure how to access just the link URL.

<a%20href%3D"http%3A//link.com.au/">http%3A//link.com.au/</a>
m.abdulqader’s picture

Issue summary: View changes

By sure those token that not appear in your list is not available, make sure to enable entity token to have access to field link URL.
on my case the token is [node:field-link:url]

RAWDESK’s picture

StatusFileSize
new85.01 KB

Hi,

I'm experiencing another issue with custom wrappers set on a teaser view mode :

custom wrapper

When my content type is set to be multilinguale and my custom links are set like :
/nl/node/1/edit > field-link = "dutch-path-alias"
/fr/node/1/edit > field-link = "french-path-alias"
where nl is my base language

then on fr/node/1 my wrapped link looks like :
onclick="location.href='fr/dutch-path-alias'"

For some reason the token replacement is not taking into account of the global language (read: active language).

I thought i could fix it using this patch :
https://www.drupal.org/node/535522#comment-9265551
without any luck though.

Is this a DS, i18n or token issue ?

#UPDATE

Fixed at https://www.drupal.org/node/2475743#comment-11833928