Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Field strip outer

No security coverage Under active development 7 sites

This module allows themers to easily remove the outer divs from fields directly within the "Manage display" formatter settings. This provides a flexible way to control the HTML structure of fields for different view modes without needing to override entire field templates.

This module provides a simple way for themers to remove outer divs from fields directly from Manage display formatter settings.
You only have to override field.html.twig and you can have surrounding field divs for one field in one display and remove them in another display. No other field template override is required.

Installation

Install this module normally, just like you would install a contributed Drupal module. Visit https://www.drupal.org/node/1897420 for further information.

If you don't have one, create a custom theme (https://www.drupal.org/docs/theming-drupal).

Copy field.html.twig from drupal core (web/core/modules/system/templates/field.html.twig) or from the parent theme or your theme.

Use the code following code snippet to have both stripped or normal DOM version :

{% if stripouter_valueonly %}:

  {% for item in items %}
    {{ item.content }}
  {% endfor %}

{% else %}

  <!-- content from field.html.twig -->

{% endif %}

Clear your cache.

Go to your content type "Manage display" tab and edit your field display setting to control DOM output for one view mode or another.

Other modules :

Please consider using No Markup module first as it have more installations.

We still continue to maintain this module.

Drupal 8–10 · not 11

Ask your assistant about Field strip outer

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

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Oct 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core PHP Release date
1.0.0 Stable 8–10 Oct 17, 2023