Closed (fixed)
Project:
Name Field
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Sep 2015 at 15:32 UTC
Updated:
27 Mar 2018 at 14:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
aaronbaumanHere's a simple patch that fixes this for my case.
In a nutshell: name_tokens() makes the incorrect assumption that $type is equivalent to $entity_type.
$type is actually the token type, which can sometimes be an entity type (e.g. "user" or "node"), but sometimes is a token type (e.g. "commerce-order"). $type needs to be transformed to $entity_type (hyphens replaced with underscores) before sending to field_get_items().
This patch will not have any adverse side effects, since it merely fixes tokens that are broken.
(ie. there are no entity types with hyphens in their machine name - only underscores are allowed).
It will not break any tokens that are working now.
For a thorough background on a very similar issue, please see #2225215: Improper 'token type' definitions in hook_entity_info() implementations
Comment #3
rooby commentedThis also makes name tokens work when I have a name field in a customer profile on a commerce order.
Comment #5
alan d. commented