I use entity view reference in View arguments i use [field_collection_item:host:node:nid]
i got this error
ResponseText : Error : Call to undefined method stdClass::hostEntity() dans field_collection_tokens() (line 113 in /Volumes/data/www/mysite/sites/all/modules/contrib/field_collection/field_collection.tokens.inc).
it must be FieldCollectionItemEntity to get hostEntity

if ($collection instanceof FieldCollectionItemEntity && $entity_tokens = token_find_with_prefix($tokens, $entity_type)) {
          $host = $collection->hostEntity();
          $replacements += token_generate($entity_type, $entity_tokens, array($entity_type => $host), $options);
}

here is my patch

Comments

lazzyvn created an issue. See original summary.

abelaguado’s picture

Patch works great! Thanks.

renatog’s picture

Status: Active » Reviewed & tested by the community

The patch really makes sense.

In that case is verifying if the $collection is an instance of FieldCollectionItemEntity that's its a valid verification. Thanks a lot for that

  • RenatoG committed f1af983 on 7.x-1.x authored by lazzyvn
    Issue #2852097 by lazzyvn, abelaguado, RenatoG: Bug Token and entity...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Moving that to the dev branch

Thank you so much for your contribution @lazzyvn and for your tests @abelaguado

Status: Fixed » Closed (fixed)

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