Add own content in views templates - change body display parameters?

27 views Asked by At

I would like to change display parameters for display own content in drupal view, I would like to display body with row text and limited characters (600)

<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 service mt-4">
<div class="services__content">
<h3 class="display-3--title mt-1 text-center">{{ title }}</h3>
{{ body }}
{% if field_provide_view_more == 1 %}
{{ view_node }}
{% endif %}
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 service mt-4">
<div class="services__pic">
{{ field_image }}
</div>
</div>    
</div>
1

There are 1 answers

0
kAzAA On

I found the solution myself.

{% set text = body|render|striptags %}
{{ text|length > 600 ? text|slice(0, 200) ~ '...' : text }}