By xano on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
Token descriptions in hook_token_info() are now optional.
Drupal 7
/**
* Implements hook_token_info().
*/
function foo_token_info() {
$token['foo']['bar'] = array(
'name' => t('Bar'),
'description' => t('The bar of a foo.'),
);
}
return array(
'tokens' => $token,
);
}
Drupal 8
/**
* Implements hook_token_info().
*/
function foo_token_info() {
$token['foo']['bar'] = array(
'name' => t('Bar'),
);
return array(
'tokens' => $token,
);
}
Impacts:
Module developers
Comments
Syntax error?
Should the D8 snippet be like this?
(Note: one fewer end-curly-bracket)
Yes. I just corrected the
Yes. I just corrected the snippet. Thank you for letting us know!