I have a paragraph (image with some fields) inside a parent paragraph.

Inside the template of the parent paragraph I'd like to open the nested paragraph via link () in a modal window.

How can I access the nested paragraph in the template of the parent paragraph as a link?

  • A paragraph can not have a link. This is the point of paragraphs, they have a mandatory parent entity, they are no standalone entites with links.
    – Hudri
    Sep 8, 2023 at 10:34
  • Yes, so the easiest way would be to design the paragraph type as a jQuery or Bootstrap modal window. That's the main use case of the Paragraphs module, adding styles and javascript to paragraph types.
    – 4uk4
    Sep 8, 2023 at 11:27
  • I want to design the paragraph as a modal window. But how can I access it in the parent paragraph template?
    – deelite
    Sep 8, 2023 at 11:57
  • The modal paragraph type would render itself as a link that opens the hidden modal content. See for example jquerymodal.com
    – 4uk4
    Sep 8, 2023 at 12:16
  • The modal window itself is not my problem. I need to know how to access the referenced paragraphs content.
    – deelite
    Sep 8, 2023 at 12:52

1 Answer 1


The most generic solution would be a layout paragraph type designed to display a hidden modal window. A layout paragraph type usually contains only one field, a paragraph reference field to add more nested paragraphs. There is no need to reference nested or parent paragraphs, paragraphs render recursively.

You can also make a modal version of the image paragraph type which puts {{ content }}, containing the image field and other fields, in a modal window body. See for example Ajaxly login/signup in bootstrap modal

  • My problem is, that I don't know how to make the modal version of the image paragraph.
    – deelite
    Sep 8, 2023 at 17:37
  • I've linked an answer moving the content of a block in a modal window. This works the same for a paragraph template.
    – 4uk4
    Sep 9, 2023 at 7:56
  • Sorry, my mistake! I don't know how to call the modal version of the paragraph. I can build a modal specific template for the modal version of the image. But how should the link to the paragraph with the specific view mode look like?
    – deelite
    Sep 11, 2023 at 6:48
  • paragraph--paragraph-type--view-mode.html.twig
    – 4uk4
    Sep 11, 2023 at 7:16
  • This is the filename of the template. OK. I don't know how I access (in link) the referenced paragraph in parent paragraphs template. In paragraph--parent--full.html.twig: <a href="{{ PARAGRAPH_REFERENCED_VIEW-MODE }}>link text</a> the paragraph_referenced_view-mode I need.
    – deelite
    Sep 11, 2023 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.