Module Description
Site Settings and Labels This module provides a way to let clients manage settings you define without affecting the configuration of the site (ie, as 'Content'). It does the following:


* provides an interface for administrators to set up settings
* allows administrators to add one or more fields to each setting
* allows the administator to decide whether to allow multiple occurrences of the same setting
* allows the administrator to group settings together
* provides a simple interface for anyone with the new permissions to add, edit, and delete site settings content
* caches the data and efficiently makes it available in every twig template
* stores the configuration for each setting as config so site builders can version control the available settings and their fields while keeping the content added to each setting outside of version control
* makes the settings available as tokens for use anywhere tokens are used (note that tokens are only supported at this time for non-repeating site settings that contain a single field)
* allows quick mass replication of settings and labels
* provides a simple block to output site settings, further customisable in templates as described below

Example use cases
* You want to let a client add one or more social networks with links to their profile pages and you want to show that on a few templates such as the header and footer
* You want to let a client add some general settings to control how or where things are displayed
* You want to allow a client to specify some general labels or settings you use throughout your site
* Anything else not suitable as a full content type, taxonomy term, block content, etc
* You want to let a client add some general settings that they can reuse as tokens in for instance automated emails (see note above)

Installation To install this module, place it in your modules folder and enable it on the modules page.

Configuration Optionally change the variable name your twig files will receive the site settings into at /admin/config/site-settings/config. By default, your variables are in {{ dump(site_settings) }}.

How to set up your settings
* Set up your settings and add fields to your settings
* Use the settings in twig templates as desired or in classes or other modules as desired
* Export your settings config
* Deploy your work to your production site
* Choose your desired permissions in the admin > people > permissions tab to grant access to site editors for instance

How to access the settings in twig templates Debug your settings when debug is enabled (https://www.drupal.org/docs/8/theming/twig/debugging-twig-templates) via {{ dump(site_settings) }} or {{ dump(site_settings.your_settings_group.your_setting_name) }} for instance.

Access a non-repeating variable with one field like so: {{ site_settings.your_settings_group.your_setting_name }}

Access a non-repeating variable with multiple fields like so:

{{ site_settings.your_settings_group.your_setting_name.field_title }} {{ site_settings.your_settings_group.your_setting_name.field_subtitle }} Access a non-repeating variable with multiple fields and complex field settings:

{{ site_settings.your_settings_group.your_setting_name.field_date.value }}` {{ site_settings.your_settings_group.your_setting_name.field_date.options }} etc

Access a repeating variable with one field like so:

{% for site_setting in site_settings.your_settings_group.your_setting_name %} {{ site_setting }} {% endfor %}How to access the settings in php files Use the site_settings.loader service:

$site_settings = \Drupal::service('site_settings.loader'); $settings = $site_settings->loadAll();or

$site_settings = \Drupal::service('site_settings.loader'); $site_settings->loadByFieldset('your_settings_group');How to access the settings via the token browser Open the token browser anywhere and you'll find the settings are globally avaiable under `Site settings and labels`. Note that tokens are only supported at this time for non-repeating site settings that contain a single field.

How to replicate settings rapidly Browse to the manage settings page and choose the 'replicate' operation from the setting you wish to use as the base for replications. Add as many rows as desired and specify the new machine names, labels, and how you would like the settings grouped.

Feedback on this module Please add issues with feature requests as well as feedback on the existing functionality.

Alternative similar modules The excellent Config Pages module offers similar functionality. The way translations are handled are quite different. If there are some settings that are the same regardless of language and others (like labels) that should be translated per language, Site Settings will suit you better. More information can be found here.

Initial development Initial development of this module was sponsored by Fat Beehive until mid-2018.

Project Usage
4528
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to provide a way for clients to manage site settings without affecting the site configuration.
Data Name
site_settings

OPENAI CHATBOT

OPENAI CHATBOT

14:27:48
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.