2015-11-19 48 views
1

我试图打印出一个视图,逐个字段,以便我可以将其样式应用于其中并自定义其外观。Drupal 8 - 访问模板中内容变量的_entity以打印出内容

当我拷贝过来的意见 - 视图 - 格式化 - MY-TEMPLATE.html.twig 我可以看到在默认视图这些变量:

{# 
/** 
* @file 
* Default theme implementation to display a view of unformatted rows. 
* 
* Available variables: 
* - title: The title of this group of rows. May be empty. 
* - rows: A list of the view's row items. 
* - attributes: The row's HTML attributes. 
* - content: The row's content. 
* - view: The view object. 
* - default_row_class: A flag indicating whether default classes should be 
* used on rows. 
* 
* @see template_preprocess_views_view_unformatted() 
* 
* @ingroup themeable 
*/ 
#} 

使用后{{编制品(含量)} },我可以看到我有一个 _entity字段显示 enter image description here

但我无法弄清楚如何打印出这些特定的领域,甚至使用编制品,以了解如何将它们分开。我尝试做这样的事情:

{{ kint(content._entity) }} 

无济于事,和其他方法试图打印出来吨。

任何帮助表示赞赏!

+0

我通过使用不同的视图模板解决了我的问题,但我相信我应该能够这样做,所以我会保持这个问题的开放。 – Kato

+0

您是否尝试过content.entity? – Eyal

回答

0

这可能是因为Content._entity是一个节点实体,而不是您可以打印的可渲染数组。