Hi 2 all!
I have a problem with a render node fields as html.
I use multiply field collections to create a node, then I create a node--articles.html.twig for theming node.
In loop I create blocks and print it, but no matter what I did, field prinred with html (

) or not printed else.
Help me please!

Comments

vindesh’s picture

As you have created node--articles.html.twig, you can print {{ dump(node) }}
It is return the object of node and you can place your content type field according to result like this
Image field URI: {{ file_url(value.entity.fileuri) }}
Image field SRC: {{ file_url(value.entity.fileuri) }}
Body: {{ content.body }}
Title: {{ content.title }}

multi-images: {% for value in node.field_image %}
Only local images are allowed.
{% endfor %}

Same thing you can place the content type fields.

Thank you

GodZiLA’s picture

thanx for your reply!
I do smth like this
{% for field in node.field_collection_fields %}
{% set title = field.getFieldCollectionItem().field_block_title.value %}
{% set block_1 = content.getFieldCollectionItem().field_text_block_1.value %}
{% set block_2 = field.getFieldCollectionItem().field_text_block_2.value %}

but it rendered with html-tags. I tried use some filters, but it didn't work.