我有一个树枝文件:views-view-unformatted--view-machine-name.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
*/
#}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
{% for row in rows %}
{%
set row_classes = [
default_row_class ? 'views-row',
]
%}
<div{{ row.attributes.addClass(row_classes) }}>
{{ row.content }}
</div>
{% endfor %}
我希望Title
and body
字段位于1行中,并以逗号分隔,例如:
标题,正文
在调试时,如何在此视图中获取“标题”或“正文”或任何其他字段的值?
我使用了kint(title)和kint(body),但是它不起作用。我也在debug = TRUE;
服务文件中做了。
但是无法弄清楚在未格式化的html树枝中具有字段值的方法。