Skip to content
Snippets Groups Projects
Commit 0ad092be authored by jurgenhaas's avatar jurgenhaas
Browse files

Add patch to group module

parent 8d444cb3
No related branches found
No related tags found
1 merge request!367Merging develop into main
Pipeline #1364663 passed
......@@ -124,6 +124,9 @@
"drupal/glossify": {
"#3360633 HTML entities": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3360633.diff"
},
"drupal/group": {
"#3416324 Related entity tokens": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3416324.diff"
},
"drupal/http_client_manager": {
"#3385117 Code generator": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3385117.diff"
},
......
......@@ -124,6 +124,9 @@
"drupal/glossify": {
"#3360633 HTML entities": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3360633.diff"
},
"drupal/group": {
"#3416324 Related entity tokens": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3416324.diff"
},
"drupal/http_client_manager": {
"#3385117 Code generator": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3385117.diff"
},
......
diff --git a/group.tokens.inc b/group.tokens.inc
index 686b2756bd7d49bbd89b4ea7a3633473c933bc7b..1f904fdcb11ee3c11fa628c4304eeb2a44ecdca4 100644
--- a/group.tokens.inc
+++ b/group.tokens.inc
@@ -272,5 +272,21 @@ function group_tokens($type, $tokens, array $data, array $options, BubbleableMet
if ($changed_tokens = $token_service->findWithPrefix($tokens, 'changed')) {
$replacements += $token_service->generate('date', $changed_tokens, ['date' => $group_relationship->getChangedTime()], $options, $bubbleable_metadata);
}
+
+ // Provide access to tokens of the related entity.
+ if (str_starts_with($name, 'entity:')) {
+ $entity = $group_relationship->getEntity();
+ $entityTypeId = $entity->getEntityTypeId();
+ $bubbleable_metadata->addCacheableDependency($entity);
+ $parts = explode(':', $name);
+ $parts[0] = $entityTypeId;
+ $realTokens = [
+ implode(':', $parts) => $original,
+ ];
+ if ($entity_tokens = $token_service->findWithPrefix($realTokens, $entityTypeId)) {
+ $replacements += $token_service->generate($entityTypeId, $entity_tokens, [$entityTypeId => $entity], $options, $bubbleable_metadata);
+ }
+ }
+
}
}
......@@ -118,6 +118,9 @@
"drupal/gin_toolbar": {
"#3319445 Permission check": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3319445.diff"
},
"drupal/group": {
"#3416324 Related entity tokens": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3416324.diff"
},
"drupal/glossify": {
"#3360633 HTML entities": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3360633.diff"
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment