Workflow participants provides tokens for existing entity types, however it also specifies "subtypes", which the Token API does not appear to support.
if ($entity_type->entityClassImplements(EditorialContentEntityBase::class)) {
$types[$entity_type->id()]['workflow_participants'] = [
'name' => $this->t('Workflow participants for @type', ['@type' => $entity_type->getLabel()]),
'description' => $this->t('Tokens for workflow participants.'),
];
...
These tokens are also added as part of hook_token_info() rather than hook_token_info_alter(), even though they are supplementing the set of tokens provided by the Token module.
These two things combine to form a bug that prevents the block_content token type from receiving its basic information. i.e.
- When collecting token information,
hook_token_info() is invoked and Workflow Participants ends up adding an entry for $info['types']['block_content']['workflow_participants'].
- The alter hooks are run and
token_token_info_alter() gets invoked.
- It tries to populate a few properties like
name for block_content, but sees that the array key already exists, so it assumes that something else already put the correct information there and skips over it, leaving it without a name.
Comments
Comment #2
kevin.dutra commentedHere's a test to demonstrate the problem.
Comment #4
kevin.dutra commentedAnd here's a fix.
Comment #6
kevin.dutra commentedOops, and here's a fix for the test I broke.
Comment #8
jhedstromGreat find! Thanks for the fix and the test coverage!