I would like to pull a value from a field I have in Paragraphs.

I have a content type called "Landing Pages" (landing_pages)

I have a paragraph type called "Landing Page" (landing_page)

The field in the said paragraph type that I would like to pull is called "Background Color" (field_background_color)

As you can probably guess, I would like the user to be able to set the background color of the individual Paragraph. I have figured out how to get the template to display said inline style, but I am puzzeled on how to get the value in the "style=background-color:" tag.

Any help would be appreciated

  • Here is the template file snippet that I'm working with: <!-- language-all: lang-html --> {% block paragraph %} <div{{ attributes.addClass(classes) }} style="background-color:{{ paragraph.landing_page.field_background_color.value }}"> {% block content %} {{ content }} {% endblock %} </div> {% endblock paragraph %}
    – blur
    Nov 17, 2019 at 21:50
  • In the respective paragraph template, its simply: paragraph.field_background_color.value
    – Kevin
    Nov 17, 2019 at 22:18
  • ahhh....thank you!
    – blur
    Nov 17, 2019 at 22:28


Browse other questions tagged or ask your own question.