Drupal is a registered trademark of Dries Buytaert

static_label

No security coverage
View on drupal.org

Overview

The Static Label module (machine name: static_label) provides a custom content entity to manage static labels as key → value pairs in Drupal.

It is designed especially for headless and decoupled architectures, where frontend applications (such as React, Angular, Flutter, etc.) need configurable, multilingual static text that can be managed centrally in Drupal and exposed via an API.

This allows frontend teams to update labels without changing frontend code, while fully leveraging Drupal’s content and translation capabilities.

The module also includes an optional REST API submodule (static_label_rest_api) to expose these labels programmatically.

Module Structure

  • static_label
  • Base module that defines the Static Label entity and UI.

  • static_label_rest_api
  • Submodule that exposes Static Labels via a REST endpoint.

Key Features

  • Manage key → value static labels
  • Supports multilingual translations
  • Drupal admin UI for CRUD operations
  • Designed for headless / decoupled frontends
  • Optional REST API for frontend consumption

Use Cases

  • Centralized management of frontend UI labels
  • Error messages, form labels, helper texts
  • Multilingual frontend applications
  • Avoid hardcoding labels in frontend code
  • Reuse the same labels across web and mobile apps

Manage Static Labels

After enabling the base module:

  1. Navigate to
  2. Content → Static Labels
    (/admin/content/static-labels)

  3. You can:
  • Add new static labels
  • Edit or delete existing labels
  • Translate labels (if multilingual is enabled)

Enable Multilingual Support

To enable translations for Static Labels:

  1. Go to
  2. /admin/config/regional/content-language

  3. Enable translations for the Static Label entity
  4. Configure the required languages

Example Usage

Create a Static Label

  1. Go to
  2. /admin/content/static-labels

  3. Click Add Static Label
  4. Enter:
  • Key (unique machine name, e.g. lbl_firstname)
  • Label (e.g. Enter the first name)
  • Save the label

REST API Submodule (static_label_rest_api)

Overview

The Static Label REST API submodule exposes static labels via a REST endpoint, making them easily consumable by frontend applications.

This submodule depends on:

  • static_label
  • rest
  • serialization

REST Endpoint
GET /api/v1/static-labels

Optional Query Parameters

Parameter
key - Fetch a specific label by machine name
lang - Language code (e.g. en, fr)

/api/v1/static-labels?key=lbl_firstname
/api/v1/static-labels?lang=ta

Sample API Output

{
  "meta": {
    "count": 3,
    "lang": "en"
  },
  "data": {
    "lbl_firstname": "Enter the first name",
    "lbl_password": "Enter the password",
    "err_msg_password": "Please enter the valid password!"
  }
}

REST Configuration

The REST resource configuration is automatically managed by the submodule.

  • Config is installed from config/install
  • Config is automatically removed on module uninstall
  • No manual cleanup required

Frontend Usage (Headless CMS)

In a headless Drupal setup, frontend applications can fetch static labels from Drupal and render them dynamically.

Benefits

  • Update labels anytime from Drupal
  • No frontend redeployment required
  • Multilingual support out of the box
  • Consistent content across platforms

Supported Frontends

  • React
  • Angular
  • Flutter , etc
  • Any framework capable of consuming JSON APIs

Installation

Troubleshooting

  • Clear caches after installing or updating modules
  • Ensure multilingual settings are enabled for translations
  • Ensure REST and serialization modules are enabled when using the API
  • Verify REST resource configuration at
  • /admin/config/services/rest

Maintainer

Mamallan A
https://www.drupal.org/u/mamallana

Support

For bug reports, feature requests, and general support, use the issue queue:

👉 https://www.drupal.org/project/issues/static_label

Activity

Total releases
1
First release
Feb 2026
Latest release
3 weeks ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.0-alpha1 Pre-release Feb 6, 2026