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) }} を使用した後、show のように _entity フィールドがあることがわかります ここに画像の説明を入力

ただし、これらの特定のフィールドを出力する方法や、Kint を使用してそれらを分離する方法を見つける方法さえわかりません。私は次のようなことを試みました:

{{ kint(content._entity) }}

役に立たず、それを印刷しようとする他の方法がたくさんあります。

どんな助けでも大歓迎です!

4

1 に答える 1

0

おそらく Content._entity がノード エンティティであり、印刷できるレンダリング可能な配列ではないためです。

于 2016-04-10T11:29:02.190 に答える