module Alchemy::ConfigurationMethods
Public Instance Methods
configuration(name)
click to toggle source
Returns the configuration value of given key.
Config
file is in config/alchemy/config.yml
# File lib/alchemy/configuration_methods.rb, line 15 def configuration(name) Config.get(name) end
multi_language?()
click to toggle source
Returns true if more than one language is published on current site.
# File lib/alchemy/configuration_methods.rb, line 21 def multi_language? Language.on_current_site.published.count > 1 end
multi_site?()
click to toggle source
Returns true if more than one site exists.
# File lib/alchemy/configuration_methods.rb, line 39 def multi_site? Site.count > 1 end
prefix_locale?(locale = Current.language&.code)
click to toggle source
Decides if the locale should be prefixed to urls
If the current languageās locale (or the optionally passed in locale) matches the current I18n.locale then the prefix os omitted. Also, if only one published language exists.
# File lib/alchemy/configuration_methods.rb, line 31 def prefix_locale?(locale = Current.language&.code) return false unless locale multi_language? && locale != ::I18n.default_locale.to_s end