|
|
3 hours ago | |
|---|---|---|
| config | 11 hours ago | |
| src | 3 hours ago | |
| templates | 9 hours ago | |
| tests/src/Unit | 11 hours ago | |
| LICENSE | 9 hours ago | |
| README.md | 10 hours ago | |
| composer.json | 10 hours ago | |
| dynamic_field_label.info.yml | 11 hours ago | |
| dynamic_field_label.links.menu.yml | 11 hours ago | |
| dynamic_field_label.module | 10 hours ago | |
| dynamic_field_label.permissions.yml | 11 hours ago | |
| dynamic_field_label.routing.yml | 11 hours ago | |
README.md
Dynamic Field Label
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.