1

我正在尝试逐个字段打印出一个视图,以便我可以将我的样式应用于它并自定义它的外观。

当我复制 views-view-unformatted--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
 */
#}

使用 {{ kint(content) }} 后,我可以看到我有一个 _entity 字段作为显示 在此处输入图像描述

但是我无法弄清楚如何打印出这些特定字段,甚至无法使用 Kint 找出如何将它们分开。我试过做这样的事情:

{{ kint(content._entity) }}

无济于事,还有很多其他尝试打印出来的方法。

任何帮助表示赞赏!

4

1 回答 1

0

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

于 2016-04-10T11:29:02.190 回答