- Issue created by @pcambra
- Merge request !5Issue #3487478: Allow caption tokens from parent (paragraph entity) → (Merged) created by pcambra
- 🇪🇸Spain pcambra Asturies
If this is an acceptable solution, I'll add an equivalent MR to https://www.drupal.org/project/glightbox_media_video →
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi pcambra, it will be tricky to define 'mainly' paragraph automatically. Glightbox image formatter which is being applied to Image field can be referenced to Media entity first and Media field attached in Paragraph directly or in nested paragraph with Gallery and Gallery Item paragraph types. Image field can be included in 'mainly' Gallery paragraph type directly. Paragraph module is not limited by any structure or nested levels.
It's possible to prepare tokens for specific (common, most popular) cases:
1. Multiple image field inside 'mainly' Paragraph (without Media).
2. Single image field in paragraph Gallery Item and Gallery 'mainly' parent paragraph type (without Media).
3. Multiple media field inside 'mainly' Paragraph.
4. Single media field in paragraph Gallery Item and Gallery 'mainly' parent paragraph type.It can be one token 'Parent title', but here is another problem, which field must be selected for this token. Gallery id is being generated automatically without additional complexity with Text field at the end.
It can be token by reference:
referenece_field_name:parent_entity:reference_field_name:parent_entity:text_field_nameFrom first glance, it should be straightforward, but I'm afraid that Drupal doesn't support parent entity, because of circullar tokens (parent entities support children fields tokens, children fields tokens support parent fields tokens) and it must be tricky too:
https://www.drupal.org/project/paragraphs/issues/3067265 ✨ Paragraph templates: unable to access parent-node tokens from child-paragraphs in the default installed setup Needs reviewHere is a custom solution to create own site specific token:
https://drupal.stackexchange.com/questions/254406/how-to-get-token-of-pa...I can create only 4 tokens for cases above, then it will be possible to select field for token, but site editor must be aware which token relates for his own site depends on its structure.
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
I merged your request in 1.0.x-dev. I will try to add tokens on the next week.