discourse/app/controllers/admin/config
Martin Brennan 19af83d39e
FEATURE: Themeable site settings (#32233)
This commit introduces the concept of themeable site settings,
which is a new tool for theme authors that lives alongside theme
modifiers and theme settings. Here is a quick summary:

* Theme settings - These are custom settings used to control UI and functionality within your theme or component and provide configuration options. These cannot change core Discourse functionality.
* Theme modifiers - Allows a theme or a component to modify selected server-side functionality of core Discourse as an alternative to building a plugin.
* Themeable site settings (new) - Allows a theme (not components) to override a small subset of core site settings, which generally control parts of the UI and other minor functionality. This allows themes to have a greater control over the full site experience.

Themeable site settings will be shown for all themes, whether the theme
changes
the value or not, and have a similar UI to custom theme settings.

We are also introducing a new page at
`/admin/config/theme-site-settings` that
allows admins to see all possible themeable site settings, and which
themes
are changing the value from the default.

### Configuration

Theme authors can configure initial values themeable site settings using
a section in the `about.json` file like so:

```json
"theme_site_settings": {
  "search_experience": "search_field"
}
```

These values will not change when the theme updates, because we cannot
know if admins have manually changed them.

### Limitations

Themeable site settings are only really intended to control elements of
the UI, and when retrieving their value we require a theme ID, so these
limitations apply:

- Themeable site settings cannot be used in Sidekiq jobs
- Themeable site settings cannot be used in markdown rules
- Themeable site settings will be cached separately to client site
settings using theme ID as a key
- Themeable site settings will override keys on the `siteSettings`
service on the client using the application preloader
- `SiteSetting.client_settings_json` will not include themeable site
settings, instead you can call `SiteSetting.theme_site_settings_json`
with a theme ID

### Initial settings

There are only two site settings that will be themeable to begin with:

* `enable_welcome_banner`
* `search_experience`

And our new Horizon theme will take advantage of both. Over time, more
settings that control elements of the UI will be exposed this way.
2025-07-16 11:00:21 +10:00
..
about_controller.rb DEV: Port the about page extra groups functionality into core (#32659) 2025-05-14 09:44:25 +08:00
color_palettes_controller.rb FEATURE: Theme-owned color palettes (#32795) 2025-06-04 07:47:58 +03:00
customize_controller.rb DEV: enable Foundation and stop Default (#33610) 2025-07-15 11:16:11 +08:00
flags_controller.rb PERF: Avoid slow preloading in SiteSerializer (#33283) 2025-06-25 15:03:34 +08:00
fonts_controller.rb UX: split admin logo and fonts to separate pages (#32700) 2025-05-14 14:02:34 +08:00
logo_controller.rb FIX: Rename branding to logo and fonts (#32264) 2025-04-14 10:49:47 +08:00
site_settings_controller.rb FEATURE: Localization admin settings config page (#31085) 2025-01-31 12:55:30 +10:00
theme_site_settings_controller.rb FEATURE: Themeable site settings (#32233) 2025-07-16 11:00:21 +10:00