πŸ‡©πŸ‡ͺGermany @captain hindsight

Account created on 21 September 2014, almost 10 years ago
#

Recent comments

πŸ‡©πŸ‡ͺGermany captain hindsight

Thought about the same but in a different way.

For the example above

[node:field_hero_image:entity:field_media_image:og_image|"/themes/custom/my_theme/image.png"]

why not extend it like that:

[node:field_hero_image:entity:field_media_image:og_image|site:base-url"/themes/custom/my_theme/image.png"]

I think this could be achieved by adding another condition in TokenOrTokensPreAlter::tokensPreAlter:

diff --git a/src/TokenOrTokensPreAlter.php b/src/TokenOrTokensPreAlter.php
index f57cace..0d34def 100644
--- a/src/TokenOrTokensPreAlter.php
+++ b/src/TokenOrTokensPreAlter.php
@@ -44,10 +44,16 @@ class TokenOrTokensPreAlter {
         $sub_tokens = explode('|', $match_clean);

         foreach ($sub_tokens as $sub_token) {
+          $sub_token_matches = [];
           if (substr($sub_token, 0, 1) === '"' && substr($sub_token, -1, 1) === '"') {
             // This is a string replacement.
             $result = substr(substr($sub_token, 1), 0, -1);
           }
+          elseif (preg_match('/([^"]*)"(.*?)"/', $sub_token, $sub_token_matches)) {
+            // This is a token replacement with an appended string.
+            $result = $this->token->replace('[' . $sub_token_matches[1] . ']', $data, $options);
+            $result .= $result ? $sub_token_matches[2] : '';
+          }
           else {
             // This is a token replacement.
             $result = $this->token->replace('[' . $sub_token . ']', $data, $options);
πŸ‡©πŸ‡ͺGermany captain hindsight

Just a quick question on this, I couldn't find a more appropriate issue. I wondered why ViewExecutable::buildThemeFunctions prefers (or even involves) the display_id as first argument over the view id.

$themes[] = $hook . '__' . $display['id'];
...
$themes[] = $hook . '__' . $id;

Is this intended? For me this looks a little bit like gambling, to even involve display_id as first argument. I stumbled on this after using a "views-view--something.html.twig" and wondered why the display of a view matched another html.twig, because its display id matched it, which I never expected...

Production build 0.69.0 2024