2016-12-05 1 views
0

このように画像をループすると画像が表示されないのはなぜですか?画像のコンテンツタイプが表示されない

{% for item in content.field_room_gallery_pictures['#items'].getValue() %} 
<div class="col-xs-6 col-md-4 image-item"> 
    {{item.value}} 
</div> 
{% endfor %} 

そして、そこですか...それはそれは私のfield_room_gallery_picturesデータの配列がある中で意味このcode..Soを使用して3の値を持つ配列が表示されますKINTを使用していない場合、私は、データをフェッチするとき。

{{kint(content.field_room_gallery_pictures['#items'].getValue())}} 

答えて

0

は、あなたのこれを試してみました:

{% for i in 0..content.field_room_gallery_pictures|length %} 
     {%if content.field_room_gallery_pictures[i]['#item'].entity.uri.value != "" and content.field_room_gallery_pictures[i]['#item'].entity.uri.value is not empty %} 
      <div> 
       {{ content.field_room_gallery_pictures[i]}} 
      </div> 
     {%endif%} 
{%endfor%} 

は私のために正常に動作します。

関連する問題