- Issue created by @Charlie ChX Negyesi
For case 'entity'
, there's $replacements += $token_service->generate('metatag', $metatag_tokens, ['entity' => $entity], $options, $bubbleable_metadata);
compare to generate($type, array $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata)
so this call puts the entity in $data
.
For case 'metatag'
there's $entity = $options['entity'] ?? metatag_get_route_entity();
but the entity is in $data
not in $options
.
In drush php
try to do \Drupal::token()->replace('[node:meta_tags:description]', ['node' => $node]);
and watch it doesn't work.
$entity = $options['entity'] ?? $data['entity'] ?? metatag_get_route_entity();
looks easy.
Translate this into a PR, test etc.
Active
2.1
Code