Drupal is a registered trademark of Dries Buytaert
drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! 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)! linkit 7.0.14 Minor update available for module linkit (7.0.14). masquerade 8.x-2.2 Minor update available for module masquerade (8.x-2.2). video_embed_field 3.1.0 Minor update available for module video_embed_field (3.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). editoria11y 3.0.2 Minor update available for module editoria11y (3.0.2). rebuild_cache_access 8.x-1.14 Minor update available for module rebuild_cache_access (8.x-1.14). webform 6.3.0-beta9 New beta version released for module webform (6.3.0-beta9). tagify 1.2.51 Minor update available for module tagify (1.2.51). symfony_mailer 2.0.0 Major update available for module symfony_mailer (2.0.0). editoria11y 3.0.1 Minor update available for module editoria11y (3.0.1).

Field Label Visibility adds a per-widget settings card to Manage form display that lets administrators hide, customize and style the label of any field on selected content types — without touching the field configuration or writing a custom theme.

Features

Each widget exposes 10 controls on Manage form display:

  1. Hide label — visually hides the label (still accessible to screen readers). Master switch: hides the rest of the controls.
  2. Custom label — replaces the field label text. Accepts Singular|Plural syntax when the next toggle is on.
  3. Singular / Plural — when enabled, parses the custom label as Singular|Plural and picks the singular form if the field currently holds 1 item, plural otherwise.
  4. HTML tag — wraps the label in h1 - h6, p, legend or label.
  5. CSS classes — adds a sanitized list of classes.
  6. HTML id — adds an id attribute, validated against the HTML id regex.
  7. CKEditor-style toolbar — alignment radios (default / left / center / right) plus Bold, Italic and Underline checkboxes, grouped in a single horizontal toolbar with SVG icons and a CKEditor-like active state.

Use cases

  • Make the field label render as a heading (h2) instead of a regular form label, without writing a Twig override.
  • Replace a generic field name with a marketing copy on a per-content-type basis.
  • Hide labels on summary/teaser fields without touching the field config.
  • Apply alignment + format (bold / italic / underline) to a label for visual emphasis.
  • Render plural-aware labels: Image|Images automatically pluralizes based on the current item count.

Accessibility

  • The original label for="…" is always preserved in the DOM, even when a heading or paragraph tag is selected. The input keeps an accessible name on every form.
  • The injected markup is decorative (aria-hidden="true"); the accessible name is the original label, whose #title is updated to mirror the custom text. Screen-reader users and visual users hear/see the same string.

Security

  • Tag is allowlisted; CSS classes pass through a regex filter; id is regex-validated; alignment values are allowlisted; Bold/Italic/Underline are cast to strict booleans; text is escaped with Html::escape() before concatenation.
  • Server-side validators reject invalid id and disallowed CSS class characters at submit time.
  • The admin form is GET-only and inherits CSRF protection from ConfigFormBase. Bundles are intersected with real node_type machine names on submit (defense in depth).
  • Module config is propagated as a cache dependency on every node form widget, so toggling bundles invalidates cached forms (Dynamic Page Cache, BigPipe).

Requirements

  • Drupal 10.3+ or Drupal 11.
  • PHP 8.3+.
  • Core modules field and node. field_ui is recommended for the Manage form display UI but is not a hard dependency — runtime application keeps working without it once the settings are saved.

Installation

composer require drupal/field_label_visibility
drush en field_label_visibility

Configuration

  1. Go to Configuration → User interface → Field Label Visibility.
  2. Tick the content types where the per-widget options should be exposed. Save.
  3. Visit Structure → Content types → [your type] → Manage form display, click the cog icon next to any widget, and configure the 10 controls.

Tests

Ships with kernel coverage (14 tests, 191 assertions): bundle gating, third-party form shape, hide_label precedence, the happy path, every injected tag is decorative, Singular/Plural in both branches and OFF mode, invalid id is dropped, XSS resistance against four payloads, #prefix concatenation, custom label propagation to the original #title, settings summary, and multi-value (cardinality > 1) propagation across all deltas.

Issues

Bug reports and feature requests can be filed in the issue queue.

Activity

Total releases
2
First release
May 2026
Latest release
22 hours ago
Release cadence
0 days
Stability
50% stable

Releases

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