Drupal is a registered trademark of Dries Buytaert
drupal 10.6.11 Update released for Drupal core (10.6.11)! drupal 11.3.12 Update released for Drupal core (11.3.12)! drupal 11.2.14 Update released for Drupal core (11.2.14)! drupal 10.5.12 Update released for Drupal core (10.5.12)! cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)!

field_label_visibility

1 sites No security coverage
View on drupal.org

Introduction

Field Label Visibility lets site builders customize, per widget, how a field label element is rendered on a node form, directly from Manage form display. No custom code, no theme overrides, no hook_form_alter(): every option is exposed as a UI control on the widget settings panel.

Unlike Manage display, which targets the front-end view of an entity, this module operates at the form widget level and only affects the entity form display.

Features

For each enabled widget, the module exposes:

  • Hide label — removes the label element entirely from the rendered DOM (not just visually hidden).
  • Custom label text, with an optional Singular / Plural mode (Singular|Plural) that picks one form at runtime depending on the number of field items.
  • Inline format toolbar with alignment radios (left, center, right) and three formatting toggles (bold, italic, underline), CKEditor-style.
  • Optional inline wrapper tag applied inside the native label: span, small or mark. These are the only phrasing-content tags valid as label children per the WHATWG specification; headings (h1h6), p and legend are not offered because they would produce invalid HTML.
  • CSS classes and id textfields, sanitized at render time.

How it works

The module has three operating modes, all targeting the native label for="…" Drupal already renders for the field — never a parallel decorative element:

  • Default (no wrapper tag). The configured id, class and inline style flow directly to the native label through Drupal's form-element preprocess pipeline. The for= association with the input is preserved, and the configured attributes appear on the label element itself.
  • Wrapper (span, small, mark). The label text is wrapped in the chosen tag with the configured id/class/style; the surrounding label for="…" stays in place so the input keeps its accessible name. The configured attributes appear on the inner wrapper, not on the outer label.
  • Hide. #title_display is set to 'none', which tells Drupal core not to render the label at all. The element is absent from the DOM, not visually hidden via CSS.

Configuration

  1. Go to Administration » Configuration » User interface » Field Label Visibility (/admin/config/user-interface/field-label-visibility).
  2. Select the content types where the per-widget controls should appear.
  3. Save the configuration.
  4. Open Structure » Content types » [type] » Manage form display, click the gear icon next to any field widget on an enabled content type, and configure the per-widget options.

The settings page requires the Administer Field Label Visibility permission, which is restricted by default.

Security and accessibility

All user-supplied values are sanitized before being rendered:

  • The wrapper tag is restricted to an allowlist (span, small, mark).
  • CSS classes are filtered to [A-Za-z0-9_- ].
  • The id is filtered to [A-Za-z0-9_-].
  • Alignment is restricted to left, center, right.
  • The label text is HTML-escaped before being injected.

The module never breaks the accessible name of the input: in every mode the original label for="…" is either preserved (with custom text and/or attributes) or completely removed from the DOM. There is never a duplicate, decorative twin label competing with the real one.

Differences with similar projects

Field Label Visibility is intentionally narrow in scope: it customizes how the form-side label of an individual field widget is rendered, configured per widget from "Manage form display", without writing any custom code or theme overrides. Nothing comparable exists in Drupal core or in the most common contrib alternatives:

  • Field UI (Drupal core) lets you reorder, group and pick widgets, but it does not expose any per-widget control over the label itself — you cannot change its text, hide it from the DOM, wrap it in an inline tag or attach an id/class/style without writing hook_form_alter() or template overrides.
  • Field Group groups several fields under a shared wrapper (fieldset, tab, accordion, …). It operates on the wrapper, not on the individual field labels, and it does not let you override a single label per widget.
  • Field Formatter Class adds CSS classes to display formatters on the front-end view of an entity. It does not touch entity forms, which is the surface this module operates on.
  • Display Suite focuses on the entity render pipeline (Manage display) with its own layouts, fields and view modes. It does not expose per-widget label controls on Manage form display.
  • hook_form_alter() / custom preprocess can of course replicate any of the above, but it requires PHP and a custom module or theme per project. Field Label Visibility makes the same outcome reachable for site builders directly from the UI.

In short: choose Field Label Visibility when you need to tune the label of a specific field widget on entity forms — change its text, hide it from the DOM, wrap it in span/small/mark, attach an id/class, align it or make it bold/italic/underline — from the UI, without touching code. For grouping fields use Field Group; for front-end display tweaks use Display Suite or Field Formatter Class; for everything else there is hook_form_alter().

Development

Parts of this module were written with the assistance of AI-assisted coding tools. All code has been reviewed, tested and maintained by the human maintainer listed below.

Activity

Total releases
4
First release
May 2026
Latest release
1 month ago
Release cadence
1 day
Stability
75% stable

Release Timeline

Releases

Version Type Release date
1.0.2 Stable May 7, 2026
1.0.1 Stable May 6, 2026
1.0.0 Stable May 4, 2026
1.0.x-dev Dev May 4, 2026