mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add plugin hook for transforming site setting defaults (#20941)
This commit is contained in:
@@ -31,18 +31,18 @@ class SiteSettings::DefaultsProvider
|
||||
end
|
||||
|
||||
def all(locale = nil)
|
||||
if locale
|
||||
@defaults[DEFAULT_LOCALE.to_sym].merge(@defaults[locale.to_sym] || {})
|
||||
else
|
||||
@defaults[DEFAULT_LOCALE.to_sym].dup
|
||||
end
|
||||
result =
|
||||
if locale
|
||||
@defaults[DEFAULT_LOCALE.to_sym].merge(@defaults[locale.to_sym] || {})
|
||||
else
|
||||
@defaults[DEFAULT_LOCALE.to_sym].dup
|
||||
end
|
||||
|
||||
DiscoursePluginRegistry.apply_modifier(:site_setting_defaults, result)
|
||||
end
|
||||
|
||||
def get(name, locale = DEFAULT_LOCALE)
|
||||
value = @defaults.dig(locale.to_sym, name.to_sym)
|
||||
return value unless value.nil?
|
||||
|
||||
@defaults.dig(DEFAULT_LOCALE.to_sym, name.to_sym)
|
||||
all(locale)[name.to_sym]
|
||||
end
|
||||
alias [] get
|
||||
|
||||
|
||||
Reference in New Issue
Block a user