Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Token requires having name property for all fields. In case of fivestar, there is no name property, so the user gets this warning on the status report page:
TOKENS OR TOKEN TYPES MISSING NAME PROPERTY: $info['tokens']['FIELD NAME']['target']
A similar issue was found on the module Real-time SEO for Drupal (link to the issue: https://www.drupal.org/node/2773075) and they just provided hook_token_info_alter in the module file so the info is attached to the token. It might be a similar fix for this module.
Comment | File | Size | Author |
---|---|---|---|
#14 | 2900863-14-target.patch | 719 bytes | TR |
#10 | token_missing-2900863-10.patch | 856 bytes | helmo |
#9 | token_missing-2900863-9.patch | 904 bytes | waverate |
Comments
Comment #2
xaben CreditAttribution: xaben commentedWe have the same issue on our project. Should be easy to reproduce.
Comment #3
Nils LoewenDrupal 8 Warning:
Was there a solution found to this issue?
Tokens or token types missing name property:
$info['tokens']['comment-field_review_rating']['target']
$info['tokens']['commerce_product-field_fivestar']['target']
Comment #4
chiefme CreditAttribution: chiefme commentedSame issue, more fields.
$info['tokens']['comment-field_rating']['target']
$info['tokens']['commerce_product-field_rating']['target']
Comment #5
wavesailor CreditAttribution: wavesailor as a volunteer commentedAnyone have an idea on how to fix this?
Comment #6
chiefme CreditAttribution: chiefme commentedmy temp solution:
edit: modules/contrib/fivestar/fivestar.module
Comment #7
magicmirror CreditAttribution: magicmirror commented#6 was a big help to me in resolving this; thank you
Comment #8
Attraktive CreditAttribution: Attraktive commentedAny news for this issue please ? (without editing source code)
thanks ! :)
Comment #9
waverate CreditAttribution: waverate commentedPatch attached.
Comment #10
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedThis seems to happen to more then just nodes, e.g. #2 also mentions a comment field.
So maybe skippging the
if ($entity_key !== 'node') {
check and extending the sprintfComment #11
prc7965 CreditAttribution: prc7965 commented#10 works. Core 8.8.4, plugin 8.x-1.0-alpha1
Thanks bro.
Comment #13
TR CreditAttribution: TR commentedPatch #10 still applies.
Comment #14
TR CreditAttribution: TR commentedActually, using an alter hook seems like the wrong thing to do - it seems to me that something is missing from our Field definition, and if we add it then Token will have the information it needs. Could it be as simple as this?
@prc7965 Is this something you could test? I need to see if this solves the issue for someone who is currently experiencing the problem.
Comment #16
TR CreditAttribution: TR commentedComment #18
TR CreditAttribution: TR commentedThe patch in #14 eliminates the warning shown on the status report page, which is the subject of this bug report. If there are any additional problems with tokens please open a new issue.
Comment #20
mybiit CreditAttribution: mybiit as a volunteer and commentedHey guys... This issue: "Token or token types missing name property" - can anyone tell me step-by-step the first thing to do to solve this problem? How to adjust this code? --> $info['tokens']['node-basic_cart_content']['quantity']