- Issue created by @promo-il
For get feld value in template you can use attribute
Example get flex-field field_poster_data>discount>value>33:
{{ dump(content.field_poster_data.0) }}
^ array:3 [▼
"#theme" => array:2 [▼
0 => "flexfield"
1 => "flexfield__field_poster_data"
]
"#field_name" => "field_poster_data"
"#items" => array:1 [▼
0 => array:4 [▼
"name" => "discount"
"value" => "33"
"label" => "Discount"
"label_display" => "above"
]
]
]
{{ dump(attribute(content.field_poster_data.0, '#items').0.value) }}
"33"
-------------------------
{# Get all subfields of FlexField [field_poster_flexdata] as array #}
{% if content.field_poster_flexdata %}{% set fieldFlexData_values = [] %}
{% set fieldFlexDataArr = attribute(content.field_poster_flexdata.0, '#items') %}{#{ dump(fieldFlexDataArr) }#}
{% for value in fieldFlexDataArr %}{#{ dump(value) }#}
{% set fieldFlexData_values = fieldFlexData_values|merge({ (value.name):{'label':value.label,'value':value.value} }) %}{#{ dump(fieldFlexData_values) }#}
{% endfor %}{{ dump(fieldFlexData_values) }}
{% endif %}