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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

osopolar created an issue. See original summary.

osopolar’s picture

Category: Feature request » Bug report
Status: Fixed » Needs review
FileSize
2.28 KB
iamjdcollins’s picture

I 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.

delacosta456’s picture

hi please will this work for panel because currently in panel only the host entity id is availaible.

osopolar’s picture