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:
- Store, call and edit system wide variables in a Drupal installation
- Place and edit variables in CSS files (it works a little bit like a CSS preprocessor)
- Deliver simple key value pairs as JSON, as a static file or via a Drupal route (since 2.2.0)
- 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).
Project information
- Project categories: Administration tools, Developer tools, Site structure
- Created by sachbearbeiter on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
New feature: Import and export of groups and variables







