- Issue created by @zany
- Merge request !7Issue #3511270: Allow caption tokens paragraph access if there is a parent paragraph → (Open) created by zany
-
levmyshkin →
committed 62d13134 on 1.0.x
Issue #3511270 by zany: Allow caption tokens paragraph access if there...
-
levmyshkin →
committed 62d13134 on 1.0.x
-
levmyshkin →
committed fa3cc4ef on 1.0.x
Issue #3511270 by zany: Allow caption tokens paragraph access if there...
-
levmyshkin →
committed fa3cc4ef on 1.0.x
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi zany, thank you for your patch! The problem is more complex in general, because some sites use Paragraph Container for galleries, some sites don't use them. Some sites use Media fields, another sites use simple Image fields. Also Media/Image fields can be attached in Taxonomy terms, Comments, Users entities, because they technically content, fieldable entities in Drupal.
So I rewrote Custom (with tokens) option, and introduced paragraph_container token for nested paragraphs. And added data for parent Node content, because for some cases people will use Node title as Gallery description or name. Also I added validation for Media extra nested level.
Here are examples of tokens which you can use:1. For paragraph with Media/Image field
[paragraph:field_name]
2. For parent paragraph with paragraph inside
[paragaph_container:field_name]
https://www.drupal.org/files/issues/2025-03-06/0d7d2694ccb90c315434974c8... →3. For Node page with paragraph gallery:
[node:title]
[node:body]
[node:field_name]
https://www.drupal.org/files/issues/2025-03-06/a5dc4234f8d7b41ba493f14aa... →It will not cover cases for:
Taxonomy term -> Paragraph -> Paragraph -> Media/Image
User -> Paragraph -> Paragraph -> Media/Image
Paragraph (additional wrapper for columns, for example) -> Paragraph -> Paragraph -> Media/Image
For these cases only [paragraph:*] and [paragraph_container:*] will be accessible in tokens, but not Taxonomy terms, Users, 3rd level Paragraph.But these cases will be working fine:
Taxonomy term -> Paragraph -> Image (without Media)
User -> Paragraph -> Image (without Media)
Because there are different Entity Types. - 🇩🇪Germany zany
Thanks! I can confirm that this change works as intended with my use-case of nested paragraphs.