Hello,

I am using Token with Simplenews in order to add node-referenced fields to my Simplenews content.

Anyway, here is the problem (see attachment for more accurate piece of information) :
I browse my replacement patterns, click on Nodes then on the Content type I'm trying to load contents' fields from.

It does list my items (Node with delta 1, Node with delta 2, Node with delta 3 etc.) and it says that "The list item with delta 1. Delta values start from 0 and are incremented by one per list item.".
So in this case the machine name of the Token should be "[node:field-simplenews-news:0]" instead of actual "[node:field-simplenews-news:1]".
The same machine name is applied to the content's fields.

In conclusion, the machines names aren't correct because in my case I do only have [node:field-simplenews-news:0] and [node:field-simplenews-news:1].

Hope this sounds clear enough ! :)

Comments

andregriffin’s picture

Thank you. I kept using the wrong replacement token. Changing the delta to 0 helped.

dave reid’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

I cannot support the tokens provided by the Entity tokens module. They are not related to this module.

dubcanada’s picture

So this is an issue with entity tokens? I also noticed this problem with tokens and pathauto it says Delta:1 and Delta:2 but no Delta:0

emattias’s picture

Status: Closed (won't fix) » Needs review
StatusFileSize
new565 bytes

This is due to PHP's way of comparing in non-strict mode.

The short version is that when using non-strict (==) comparison 0 is always evaluated to true when compared to any string. Longer exlanation here: http://stackoverflow.com/a/8672423

Delta 0 shows up by making the in_array comparison strict. This patch does that.

dave reid’s picture

Version: 7.x-1.3 » 8.x-1.x-dev
Status: Needs review » Patch (to be ported)

Oh thanks for being persistent with this. Confirmed the issue and committed to 7.x-1.x.

  • Dave Reid committed d04c7b8 on 7.x-1.x authored by emattias
    Issue #1821902 by Antonin Brunon, emattias: Fixed palse positives in...
dave reid’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Fixed

Committed to 8.x-1.x as well.

  • Dave Reid committed ab7d014 on 8.x-1.x authored by emattias
    Issue #1821902 by Antonin Brunon, emattias: Fixed palse positives in...

Status: Fixed » Closed (fixed)

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