I’m trying to create a custom template for the paragraph-progress-bar component.
The component I created has 2 fields: title (field_title) and percentage (field_percentage: integer field limited from 0 to 100).
I am using the module paragraph.
When I try to extract the content from the twig template with the following code, the result it returns to me is Array.
How can I go about extracting the field_percentage field variable. to pass in the width of the progress bar code?
I’m trying with: style=”width: {{ content.field_percentuale ~ ‘%’}};” but this code return Array.
{%
set classes = (
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
not paragraph.isPublished() ? 'paragraph--unpublished'
)
%}
{% block paragraph %}
<div{{ attributes.addClass(classes) }}>
{% block content %}
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: {{ content.field_percentuale ~ '%'}};" aria-valuenow="{{content.field_percentuale}}" aria-valuemin="0" aria-valuemax="100">{{ content.field_titolo }}</div>
</div>
{% endblock %}
</div>
{% endblock paragraph %}