Answer the question
In order to leave comments, you need to log in
Render fields via snippets?
On many pages, I get an object of type Content into the template and display its fields
<div class="place-for-first-field">
<!-- тут проверка о том что поле существуюет и что оно не пустое плюс еще какое-то специфическое условие -->
<div class="list of classes for first field">
{{ content.getField('first_field') . . . }}
</div>
</div>
<div class="place-for-second-field">
<!-- тут тоже проверка о том что поле существуюет и что оно не пустое плюс еще какое-то другое специфическое условие -->
<div class="container">
<span class="wrap around field2">
{{ content.getField('second_field') . . . }}
</span>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Alternatively, cut these fragments into mini-templates and then include them:
{# fields/_ first_field.html.twig #}
<div class="place-for-first-field">
<div class="list of classes for first field">
{{ content.getField('first_field') . . . }}
</div>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question