Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Views Templates

Security covered Under active development 18,868 sites

Part of the Views ecosystem · 280 projects

This module allows other modules to provide Views templates, which are reusable collections of templates and variable definitions that define a specific presentation style. These templates can be programmatically created or built from YAML files and can be overridden based on various view and display configurations.

This module is intended to be used by other modules to offer Views templates.
Modules can implement ViewsTemplateBuilder plugins to provide Views templates.

Extend the ViewsBuilderBase class to make View template programmatically

Extend the ViewsDuplicateBuilderBase class to make a View Template from a *.yml Views Template file.

Views Templates should put in the 'views_templates' in the root directory
of the module.

Creates the views templates functionality which was removed in D8 views. A view is effectively a collection of templates and/or variable definitions that can be passed around as a self-contained unit. This then represents a particular interface or presentation style for other objects or items of data. You can use views to implement custom "skins" for an application or content set. You can use them to help simplify the presentation of common objects or data types. You can even use them to automate the presentation of complex data structures such as that generated in an XML::DOM tree or similar. You let an iterator do the walking, and the view does the talking (or in this case, the presenting). Voila - you have to view independent, structure shy traversal using templates.

Views templates can be overridden with a variety of names, using the view, the display ID of the view, the display type of the view, or some combination thereof.

For each view, there will be a minimum of two templates used. The first is used for all views: views-view.html.twig.

The second template is determined by the style selected for the view. Note that certain aspects of the view can also change which style is used; for example, arguments that provide a summary view might change the style to one of the special summary styles.

The default style for all views is views-view-unformatted.html.twig

Many styles will then farm out the actual display of each row to a row style; the default row style is views-view-fields.html.twig.

Drupal 10–11

Ask your assistant about Views Templates

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • views Drupal core

Required by

2 tracked projects depend on this one

Activity

Tracked releases
6
Tracked since
Jun 2023
Latest release
8 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.7 Stable 10–11 Jan 30, 2026
8.x-1.6 Stable 10–11 Jul 17, 2024
8.x-1.5 Stable 10 Mar 1, 2024
8.x-1.4 Stable 10 Mar 1, 2024
8.x-1.3 Stable 9–10 Aug 18, 2023
8.x-1.2 Stable 9–10 Jun 27, 2023