You may say that I should just change the display settings but in my use case I need to include 2 view modes inside one template as the mobile and desktop version of the output require very different HTML.

Is there a way to do this or do I require some preprocess function to do this?


2 Answers 2


You could try using Twig Tweak module

{{ drupal_entity('paragraph', NUMERIC_ID, VIEWMODE_MACHINE_NAME) }}

Also see the cheat sheet for Twig tweak, it really is a great module for frontend work!

  • thank you very much, Do you know how to get the numeric ID of the paragraph?
    – drupalhgy
    May 17, 2018 at 19:02
  • 2
    If you are using the paragraph.html.twig template, you can use {{ paragraph.id() }} - it's described in the code documentation of that template file.
    – andileco
    May 18, 2018 at 4:18

This question is linked from this question. Since that question is closed, I'll answer here since I recently found something that's working (in case someone else is directed here and needs help).

My setup is like this:

Paragraph field > Paragraph Field > Some Field

I wanted to get the value of 'Some Field'. Here's how I did that:


This code goes in the paragraph--some-paragraph-name.html.twig.

Hope this is able to help someone.

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.