Created on 27 October 2024, about 2 months ago

Problem/Motivation

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.

Steps to reproduce

In drush php try to do \Drupal::token()->replace('[node:meta_tags:description]', ['node' => $node]); and watch it doesn't work.

Proposed resolution

$entity = $options['entity'] ?? $data['entity'] ?? metatag_get_route_entity(); looks easy.

Remaining tasks

Translate this into a PR, test etc.

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ฆCanada Charlie ChX Negyesi ๐ŸCanada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024