2017-09-28 36 views
0

在我的名称为“Banner”的内容类型中,我有一个类型为“Link”的字段,其中“Machine name”= field_url_destinazione。Drupal 8视图树枝内的打印字段

如果我写这在我的树枝:

{% if content %} 
    {{ content }} 
{% endif %} 

我看到标题,日期和我场“field_url_destinazione”

我需要只显示这一领域,有一种方法?

我试着用:

{{ content.field_url_destinazione }} 
{{ fields.field_url_destinazione }} 
{{ field.field_url_destinazione }} 
{{ field_url_destinazione }} 

回答

1

你的第一次尝试

{{ content.field_url_destinazione }} 

绝对应该工作。它可能无法正常工作的唯一原因是字段名称错误(或枝条模板中的任何其他错误)。


default node template说:

  • 内容:所有节点的项目。使用{{内容}}将其全部打印出来,或打印一个子集,如{{content.field_example}}。使用{{content | without('field_example')}}暂时禁止打印给定的子元素。