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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pylo created an issue. See original summary.

xaben’s picture

We have the same issue on our project. Should be easy to reproduce.

Nils Loewen’s picture

Drupal 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']

chiefme’s picture

Same issue, more fields.
$info['tokens']['comment-field_rating']['target']
$info['tokens']['commerce_product-field_rating']['target']

wavesailor’s picture

Anyone have an idea on how to fix this?

chiefme’s picture

my temp solution:
edit: modules/contrib/fivestar/fivestar.module

/**
 * Implements hook_token_info_alter().
 */
function fivestar_token_info_alter(&$info) {
    $info['tokens']['comment-field_rating']['target'] = array(
        'name' => t('Fivestar: comment-field_rating TARGET'),
    );
    $info['tokens']['commerce_product-field_rating']['target'] = array(
        'name' => t('Fivestar: commerce_product-field_rating TARGET'),
    );
}
magicmirror’s picture

#6 was a big help to me in resolving this; thank you

Attraktive’s picture

Any news for this issue please ? (without editing source code)
thanks ! :)

waverate’s picture

Status: Active » Needs review
FileSize
904 bytes

Patch attached.

helmo’s picture

This 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 sprintf

prc7965’s picture

#10 works. Core 8.8.4, plugin 8.x-1.0-alpha1
Thanks bro.

Status: Needs review » Needs work

The last submitted patch, 10: token_missing-2900863-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

TR’s picture

Status: Needs work » Needs review

Patch #10 still applies.

TR’s picture

Actually, 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.

Status: Needs review » Needs work

The last submitted patch, 14: 2900863-14-target.patch, failed testing. View results

TR’s picture

Status: Needs work » Needs review

  • TR committed a96302e on 8.x-1.x
    Issue #2900863 by TR: Token or token types missing name property
    
TR’s picture

Status: Needs review » Fixed

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

Status: Fixed » Closed (fixed)

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

mybiit’s picture

Hey 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']