I have a view that has two blocks. The blocks are essentially the same except for their filtering options. One uses contextual filters and the other uses BEF exposed filters.
Both output matching node body content in full.
Both make use of the same twig template: views-view-fields--VIEW_NAME.html.twig
<h3 class="accordion-header">{{ fields.title.content }}</h3>
<div class="accordion-content">{{ fields.body.content }}</div>
If I add:
{{ dump(fields.body.content) }}
Working version shows:
object(Drupal\Core\Render\Markup)[8515]
protected 'string' => string '
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_field' -->
<!-- BEGIN OUTPUT from 'core/modules/views/templates/views-view-field.html.twig' -->
<p>Membership universal content</p>
<!-- END OUTPUT from 'core/modules/views/templates/views-view-field.html.twig' -->
Non-working version shows:
object(Drupal\Core\Render\Markup)[2061]
protected 'string' => string '
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_field' -->
<!-- BEGIN OUTPUT from 'core/modules/views/templates/views-view-field.html.twig' -->
<p><p>Membership universal content</p></p>
<!-- END OUTPUT from 'core/modules/views/templates/views-view-field.html.twig' -->
I have a work around by adding autoescape and convert_encoding
{% autoescape false %}
<h3 class="accordion-header">{{ fields.title.content }}</h3>
<div class="accordion-content">{{ fields.body.content|convert_encoding('UTF-8', 'HTML-ENTITIES') }}</div>
{% endautoescape %}
But this is now adding additional empty p tags before and after.
I don't understand why the output for one is escaped and the output for the other is not. Any pointers would be great, thank you.