Drupal is a registered trademark of Dries Buytaert
cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8). editoria11y 2.2.22 Minor update available for module editoria11y (2.2.22). ai 1.2.13 Minor update available for module ai (1.2.13). ai 1.3.2 Minor update available for module ai (1.3.2). moderated_content_bulk_publish 2.0.51 Minor update available for module moderated_content_bulk_publish (2.0.51). moderated_content_bulk_publish 2.0.50 Minor update available for module moderated_content_bulk_publish (2.0.50). editoria11y 2.2.21 Minor update available for module editoria11y (2.2.21). eca 3.1.0 Minor update available for module eca (3.1.0). sophron 3.1.1 Minor update available for module sophron (3.1.1). ai 1.3.1 Minor update available for module ai (1.3.1).

fences

12,907 sites Security covered
View on drupal.org

Fences is an easy-to-use tool to specify an HTML element for each field. This element choice will propagate everywhere the field is used, such as teasers, RSS feeds and Views. You don't have to keep re-configuring the same HTML element over and over again every time you display the field.

Best of all, Fences provides leaner markup than Drupal core! You can also remove field, label, wrapper or value wrappers entirely.

This kind of tool is needed in order to create semantic HTML5 output from Drupal. Without such a tool, you have to create custom field templates in your theme for every field.

Similar projects include Semantic fields, Field Wrappers and a tool inside the Display Suite extras. But we think this approach is Morefasterbetterâ„¢.

Usage

  1. Download, install and enable the module.
  2. Go to any Content → Manage Display and click on the gear icon of the targeted field.
  3. Here, you have the option to define custom field, field item and label tags and add custom classes. If you're using the Fences Presets submodule, you can define and select presets to re-use.

Now anytime you display that field in a node, or even in Views, Fences will alter the markup for the field to use the element you chose. If you would like to not let Views use the Fences markup, you can still use all the power of Views to alter it. But it will use Fences by default. :)

Fences Presets

Fences presets is a new fences submodule introduced with Fences 3.0.2. This submodule allows you to define typical fences presets, which can be applied through a new select element on any display formatter using fences.

Not working with your contrib / custom theme?

If you're experiencing issues where the Fences settings do not fully apply, for example classes are added, but elements do not change, the reason might be, that your contrib / custom theme is overriding the field.html.twig file, which is higher weighted than the one from this module.

Go to /config/user-interface/fences/settings and enable "Override the field template for all themes". Clear your cache afterwards.

If its still not working, find workarounds and help us to fix that in this issue: #3306130: Doesn't work with themes overwriting field.html.twig (also core like Bartik)

Additional modules

How You Can Help

This is a work in progress! Please do file an issue if you find a bug or have a feature request. Do chime in with your ideas!

Activity

Total releases
3
First release
Feb 2025
Latest release
1 year ago
Release cadence
18 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
3.0.7 Stable Mar 11, 2025
3.0.6 Stable Feb 4, 2025
3.0.5 Stable Feb 3, 2025