我有一个文件类型字段的视图。所以我将它添加到视图中并为它重写了结果:
<a href="{{ field_documento }}">{{ title }}</a>
上面的行生成了一个 a 标签,其中包含 PDF 文档的 href 和节点标题作为标签的文本。
现在,我已将该字段替换为对媒体文档类型实体的引用 field_download
的字段。 field_mdownload
我无法使用这种类型的字段获得相同的结果。
为此,我尝试使用 Twig Twaek 和 Bamboo Twig,并尝试直接访问节点和内容,但它似乎在视图的上下文中不起作用。
我尝试使用以下内容:
node.fileld_mdocument.entity.media_file_document.uri.value
node.field_mdocument | file_uri
field_mdocument | file_uri
file_url (field_mdocument)
<% set node = bamboo_load_entity ('node', nid)%>
但是这里的 twig 似乎无法将 nid 转换为代表节点的整个值。如果我<% set node = bamboo_load_entity ('node', 1)%>
说它有效。
有谁知道我该如何解决这个问题?