Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Editablevar

Security covered Under active development

This module allows administrators to create and edit system-wide variables through the Drupal administration interface. These variables can be used in CSS files like a preprocessor, delivered as JSON, and imported/exported between Drupal installations. They can also be accessed within templates and CKEditor.

Overview

Create and edit system wide variables via the administration interface.
Easy to use for editors.

We have developed this module for a conference platform to solve the following tasks:

  1. Store, call and edit system wide variables in a Drupal installation
  2. Place and edit variables in CSS files (it works a little bit like a CSS preprocessor)
  3. Deliver simple key value pairs as JSON, as a static file or via a Drupal route (since 2.2.0)
  4. Manual import and export (as JSON) between Drupal installations. Can also be used for simple backups of the modules configuration and data.

Configuration

You find the configuration page of the Editablevars module below this link:
/admin/config/system/editablevar

You can create there "variable groups", to organize your variables and choose the favored type of group ("Simple" vs "File" vs "JSON").

In templates you can use the variables f.e. like this:

{% if editablevar('showhide_widget_chat', 'show') == 'show' %}
    {{ widget_chat|raw }}
{% endif %}

or

{% set statistics_in_head = editablevar('template_head_statistics', '') %}
{{ statistics_in_head|raw }}

or

<div id="meta" style="background-color:{{ editablevar('style_header_meta_background', 'white') }};">
("white" is the default)

CKeditor5

You can also call the variables in the CKeditor5 as token. There is a content filter available.

JSON via Drupal route (since 2.2.0)

Variable groups can also be delivered as JSON directly through Drupal, without writing a file:

/editablevar/json/{group_id}

Enable it per group with "Enable direct download of JSON File" in the group settings and grant the permission "Download editablevars as JSON" to the roles that may read it (e.g. anonymous for a public headless frontend). This avoids CORS problems with certain server configurations, when a decoupled frontend reads the variables from another domain.

After updating from 2.1.x, run drush updb (adds the column download_enabled).

Drupal 9–10 · not 11 PHP 7.3

Ask your assistant about Editablevar

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • user Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
7
Tracked since
Feb 2024
Latest release
1 week ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.2.0 Stable 9–10 PHP 7.3 Nov 4, 2026
2.1.1 Stable 9–10 PHP 7.3 Mar 7, 2024
2.1.0 Stable Mar 7, 2024
2.0.x-dev Dev 9–10 PHP 7.3 Feb 22, 2024
2.0.1 Stable 9–10 PHP 8 Feb 22, 2024
2.0.0 Stable 8–9 PHP 7.3 Feb 22, 2024
1.0.4 Stable 8–9 PHP 7.3 Feb 22, 2024