Theming in Paragraphs for Drupal 7

Theming

The default paragraphs template is in paragraphs-item.tpl.php.
It uses theme suggestions for other templates, the following suggestions are available:

  • paragraphs__[view_mode] (e.g. paragraph--default.tpl.php)
  • paragraphs__[type] (e.g. paragraph--image.tpl.php)
  • paragraphs__[type]__[view_mode] (e.g. paragraph--image--default.tpl.php)

Using attributes in templates

Documentation of attributes object that appears in all html.twig templates.

Theming in Paragraphs for Drupal 8

Theming

The default paragraphs template is in paragraphs-item.html.twig.
It uses theme suggestions for other templates, the following suggestions are available:

  • paragraph__[view_mode] (e.g. paragraph--default.html.twig)
  • paragraph__[type] (e.g. paragraph--image.html.twig)
  • paragraph__[type]__[view_mode] (e.g. paragraph--image--default.html.twig)

Filters - Modifying Variables In Twig Templates

Filters in Twig can be used to modify variables. Filters are separated from the variable by a pipe symbol (|) and may have optional arguments in parentheses. Multiple filters can be chained. The output of one filter is applied to the next.

Example: {{ ponies|safe_join(", ")|lower}}

The list of filters that can be used in Twig templates for Drupal consists of all the filters in the Twig engine as well as some Drupal specific filters.

List of Twig filters.

Theming differences between Drupal 6, 7 & 8

This is a list of some of the most noteworthy changes in Drupal 8 that affect theming.

Pages

Subscribe with RSS Subscribe to RSS - theming