Search by

roblib / dynamic_field_label

Roblib

There is no license information available for the latest version (dev-main) of this package.

Display labels embedded in existing Drupal text field values.

Package info

git.library.upei.ca/astanley/dynamic_field_label

Type:drupal-module

pkg:composer/roblib/dynamic_field_label

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

dev-main 2026-12-04 23:57 UTC

This package is not auto-updated.

Last update: 2026-12-05 00:01:04 UTC


README

Drupal 10/11 custom module for existing configurable text fields. No field type, field schema, import or stored data changes are required.

Installation

Place this directory in web/modules/custom/dynamic_field_label (or the custom module directory appropriate to your project), then run:

drush en dynamic_field_label -y
drush cr

Go to /admin/config/content/dynamic-field-label and select the fields. The configuration matches machine names across all entity types and bundles. The permission is administer dynamic field labels.

Rendering

Publisher:University of Prince Edward Island displays as a Publisher label and University of Prince Edward Island value. Only the first colon is a separator. Whitespace around both parts is trimmed. An empty value is permitted; an empty label or missing colon falls back to the existing formatter output. Multiple values each receive their own label. Embedded labels are shown even if the Drupal label is hidden. Labels are escaped plain text and must not contain HTML tags. Values from formatted text fields are rendered through Drupal’s processed_text render element using the stored text format; plain string fields and entries without a format remain escaped plain text. Use input such as Publisher:<strong>UPEI</strong>. Do not wrap the label or entire input in HTML (for example <p>Publisher:UPEI</p>); such input falls back to the original formatter. Parsed entries display the full value rather than a trimmed formatter or summary. The module provides a field template using standard field CSS classes; a theme can override field--dynamic-field-label.html.twig.