mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-08 20:33:07 +08:00
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.
|
||
|---|---|---|
| .. | ||
| admin_notice_fabricator.rb | ||
| allowed_pm_users.rb | ||
| api_key_fabricator.rb | ||
| api_key_scope_fabricator.rb | ||
| associated_group_fabricator.rb | ||
| badge_fabricator.rb | ||
| bookmark_fabricator.rb | ||
| category_fabricator.rb | ||
| category_group_fabricator.rb | ||
| category_localization_fabricator.rb | ||
| category_moderation_group_fabricator.rb | ||
| color_scheme_color_fabricator.rb | ||
| color_scheme_fabricator.rb | ||
| custom_emoji_fabricator.rb | ||
| dimissed_topic_user.rb | ||
| do_not_disturb_fabricator.rb | ||
| draft_fabricator.rb | ||
| email_change_request_fabricator.rb | ||
| email_log_fabricator.rb | ||
| email_token_fabricator.rb | ||
| embeddable_host_fabricator.rb | ||
| embeddable_host_tag_fabricator.rb | ||
| external_upload_stub_fabricator.rb | ||
| flag_fabricator.rb | ||
| flag_post_action_fabricator.rb | ||
| form_template_fabricator.rb | ||
| group_fabricator.rb | ||
| group_history_fabricator.rb | ||
| group_request_fabricator.rb | ||
| group_user_fabricator.rb | ||
| ignored_user_fabricator.rb | ||
| incoming_email_fabricator.rb | ||
| incoming_link_fabricator.rb | ||
| invite_fabricator.rb | ||
| invited_user_fabricator.rb | ||
| like_fabricator.rb | ||
| moved_post_fabricator.rb | ||
| muted_user.rb | ||
| notification_fabricator.rb | ||
| optimized_image_fabricator.rb | ||
| permalink_fabricator.rb | ||
| post_action_fabricator.rb | ||
| post_custom_field_fabricator.rb | ||
| post_detail_fabricator.rb | ||
| post_fabricator.rb | ||
| post_localization_fabricator.rb | ||
| post_reply_key_fabricator.rb | ||
| post_revision_fabricator.rb | ||
| problem_check_tracker_fabricator.rb | ||
| published_page_fabricator.rb | ||
| push_subscription_fabricator.rb | ||
| redelivering_webhook_event_fabricator.rb | ||
| reviewable_claimed_topic_fabricator.rb | ||
| reviewable_fabricator.rb | ||
| reviewable_note_fabricator.rb | ||
| reviewable_score_fabricator.rb | ||
| screened_email_fabricator.rb | ||
| screened_ip_address_fabricator.rb | ||
| screened_url_fabricator.rb | ||
| search_log_fabricator.rb | ||
| shared_draft_fabricator.rb | ||
| sidebar_section_fabricator.rb | ||
| sidebar_section_link_fabricator.rb | ||
| sidebar_url_fabricator.rb | ||
| single_sign_on_record_fabricator.rb | ||
| skipped_email_log_fabricator.rb | ||
| tag_fabricator.rb | ||
| tag_group_fabricator.rb | ||
| tag_group_permission_fabricator.rb | ||
| tag_user_fabricator.rb | ||
| theme_fabricator.rb | ||
| theme_field_fabricator.rb | ||
| theme_settings_migration_fabricator.rb | ||
| theme_site_setting_fabricator.rb | ||
| topic_allowed_group_fabricator.rb | ||
| topic_allowed_user_fabricator.rb | ||
| topic_embed_fabricator.rb | ||
| topic_fabricator.rb | ||
| topic_localization_fabricator.rb | ||
| topic_tag_fabricator.rb | ||
| topic_timer_fabricator.rb | ||
| topic_user_fabricator.rb | ||
| topic_view_stat_fabricator.rb | ||
| translation_override_fabricator.rb | ||
| upload_fabricator.rb | ||
| user_action_fabricator.rb | ||
| user_api_key_fabricator.rb | ||
| user_associated_account_fabricator.rb | ||
| user_avatar_fabricator.rb | ||
| user_badge_fabricator.rb | ||
| user_custom_field_fabricator.rb | ||
| user_email_fabricator.rb | ||
| user_fabricator.rb | ||
| user_field_fabricator.rb | ||
| user_field_option_fabricator.rb.rb | ||
| user_history_fabricator.rb | ||
| user_option_fabricator.rb | ||
| user_password_fabricator.rb | ||
| user_profile_fabricator.rb | ||
| user_second_factor_fabricator.rb | ||
| user_security_key_fabricator.rb | ||
| user_status_fabricator.rb | ||
| watched_word_fabricator.rb | ||
| watched_word_group_fabricator.rb | ||
| web_crawler_request_fabricator.rb | ||
| web_hook_event_fabricator.rb | ||
| web_hook_fabricator.rb | ||