Follow-up to #1372652: Token support for host entity
I had problems to get the right value from [field_collection_item:host:node:url:path]
(for the field-collection pathauto alias). Instead of the expected node alias the token returned node/{nid} because instead of the actual node language LANGUAGE_NONE was passed as option for the node tokens.
I attached a patch where the host entity's language will be passed as option to token_generate(). I am not entirely sure if that is the correct way to fix it. Or maybe it get fixed somehow with the issue #1344672: Field Collection: Field translation (entity_translation) support.. At least it works for my purposes.
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff-2-5.patch | 3.86 KB | osopolar |
#5 | field_collection-token-host-entity-language-2567203-5.patch | 2.22 KB | osopolar |
Comments
Comment #2
osopolarComment #3
iamjdcollins CreditAttribution: iamjdcollins commentedI can confirm that this patch does improve support for the token I am using. In my case I needed the name of term reference field.
[field_collection_item:host:node:field-term-reference:name]
Prior to the patch it was not returning a value.
**UPDATE
I wanted to test reverting back to dev to see if it would break and somehow it did not. I tried for a few hours on the dev to make this work without luck. Applied the path and ever since it just works.
Comment #4
delacosta456 CreditAttribution: delacosta456 commentedhi please will this work for panel because currently in panel only the host entity id is availaible.
Comment #5
osopolarRe-roll patch #2.