views-view-field.html.twig

Same filename in this branch
  1. 8.9.x core/themes/stable/templates/views/views-view-field.html.twig
  2. 8.9.x core/modules/views/tests/themes/views_test_theme/templates/views-view-field.html.twig
Same filename in other branches
  1. 9 core/themes/stable9/templates/views/views-view-field.html.twig
  2. 9 core/themes/stable/templates/views/views-view-field.html.twig
  3. 9 core/modules/views/tests/themes/views_test_theme/templates/views-view-field.html.twig
  4. 9 core/modules/views/templates/views-view-field.html.twig
  5. 10 core/themes/stable9/templates/views/views-view-field.html.twig
  6. 10 core/modules/views/tests/themes/views_test_theme/templates/views-view-field.html.twig
  7. 10 core/modules/views/templates/views-view-field.html.twig
  8. 11.x core/themes/stable9/templates/views/views-view-field.html.twig
  9. 11.x core/modules/views/tests/themes/views_test_theme/templates/views-view-field.html.twig
  10. 11.x core/modules/views/templates/views-view-field.html.twig

Default theme implementation for a single field in a view.

Available variables:

  • view: The view that the field belongs to.
  • field: The field handler that can process the input.
  • row: The raw result of the database query that generated this field.
  • output: The processed output that will normally be used.

When fetching output from the row this construct should be used: data = row[field.field_alias]

The above will guarantee that you'll always get the correct data, regardless of any changes in the aliasing that might happen if the view is modified.

See also

template_preprocess_views_view_field()

File

core/modules/views/templates/views-view-field.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a single field in a view.
  5. *
  6. * Available variables:
  7. * - view: The view that the field belongs to.
  8. * - field: The field handler that can process the input.
  9. * - row: The raw result of the database query that generated this field.
  10. * - output: The processed output that will normally be used.
  11. *
  12. * When fetching output from the row this construct should be used:
  13. * data = row[field.field_alias]
  14. *
  15. * The above will guarantee that you'll always get the correct data, regardless
  16. * of any changes in the aliasing that might happen if the view is modified.
  17. *
  18. * @see template_preprocess_views_view_field()
  19. *
  20. * @ingroup themeable
  21. */
  22. #}
  23. {{ output -}}

Related topics


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.