PluginSettingService Class
Constructor for service that retrieves plugin settings from the database.
Constructor
PluginSettingService
-
siteUID
Parameters:
-
siteUID
String- site unique id
Item Index
Methods
- genSettingsService static
- getAdminPluginSettingsService static
- getAdminThemeSettingService static
- getSetting
- getSettings
- getSettingsBySite
- getSettingsKV
- getThemeSetting
- getThemeSettings
- getThemeSettingsBySite
- getThemeSettingsKV
- purgePluginSettings
- purgeThemeSettings
- resetSettings
- resetThemeSettings
- setSetting
- setSettings
- setThemeSetting
- setThemeSettings
Properties
Methods
genSettingsService
-
opts.objType
-
opts.useMemory
-
opts.useCache
-
opts.serviceName
-
opts.site
-
opts.onlyThisSite
Convenience function to generate a service to handle settings for a plugin.
Parameters:
-
opts.objType
StringThe type of object that will be dealt with. (plugin_settings, theme_settings)
-
opts.useMemory
BooleanIndicates if the generated layered service should use an in memory service.
-
opts.useCache
BooleanIndicates if the generated layered service should use a cache service.
-
opts.serviceName
StringThe name of the service
-
opts.site
String -
opts.onlyThisSite
Boolean
Returns:
getAdminPluginSettingsService
-
self
Parameters:
-
self
PluginSettingService
Returns:
getAdminThemeSettingService
-
self
Parameters:
-
self
PluginSettingService
Returns:
getSetting
-
settingName
-
pluginName
-
cb
Retrieves a single setting for the specified plugin.
Parameters:
-
settingName
StringThe name of the setting to retrieve
-
pluginName
StringThe name of the plugin who owns the setting
-
cb
FunctionA callback that provides two parameters: cb(error, settingValue). Null is returned if the setting does not exist or the specified plugin is not installed.
getSettings
-
pluginName
-
cb
Retrieves all of the settings for the specified plugin.
Parameters:
-
pluginName
StringThe name of the plugin who's settings are being requested
-
cb
FunctionA callback that provides two parameters: cb(error, settings). Null is provided in the event that the plugin is not installed.
getSettingsBySite
-
pluginName
-
cb
Gets the plugin settings for one site only. Will not default to global plugin settings for given plugin.
Parameters:
-
pluginName
String- name of plugin to retrieve settings for
-
cb
Function- callback function
getSettingsKV
-
pluginName
-
cb
Retrieves the settings for a plugin as hash of key/value pairs. This differs from the getSettings function because the getSettings function provides the settings in their raw form as an array of objects containing multiple properties. In most circumstances just the k/v pair is needed and not any additional information about the property. The function takes the raw settings array and transforms it into an object where the setting name is the property and the setting value is the value.
Parameters:
-
pluginName
StringThe unique ID of the plugin who settings are to be retrieved
-
cb
FunctionA callback that takes two parameters. A error, if exists, and a hash of of the plugin's settings' names/values.
getThemeSetting
-
settingName
-
pluginName
-
cb
Retrieves a single theme setting value.
Parameters:
-
settingName
ObjectThe uid of the setting
-
pluginName
ObjectThe plugin to retrieve the setting from
-
cb
ObjectA callback that provides two parameters: cb(error, settingValue)
getThemeSettings
-
pluginName
-
cb
Retrieves the theme settings for the specified plugin
Parameters:
-
pluginName
ObjectThe uid of the plugin
-
cb
ObjectA callback that provides two parameters: cb(err, settingsObject)
getThemeSettingsBySite
-
pluginName
-
cb
Retrieves theme settings for specified plugin and for only the specified site. Will not default to global theme settings.
Parameters:
-
pluginName
String- the name of the plugin to get theme settings
-
cb
Function- callback function
getThemeSettingsKV
-
pluginName
-
cb
Retrieves the theme settings for a plugin as hash of key/value pairs. This differs from the getThemeSettings function because the getThemeSettings function provides the settings in their raw form as an array of objects containing multiple properties. In most circumstances just the k/v pair is needed and not any additional information about the property. The function takes the raw settings array and transforms it into an object where the setting name is the property and the setting value is the value.
Parameters:
-
pluginName
StringThe unique ID of the plugin who settings are to be retrieved
-
cb
FunctionA callback that takes two parameters. A error, if exists, and a hash of of the plugin's settings' names/values.
purgePluginSettings
-
pluginUid
-
cb
Parameters:
-
pluginUid
String -
cb
Function
purgeThemeSettings
-
pluginUid
-
cb
Parameters:
-
pluginUid
String -
cb
Function
resetSettings
-
details
-
cb
Loads the settings from a details object and persists them in the DB. Any existing settings for the plugin are deleted before the new settings are persisted.
Parameters:
-
details
ObjectThe details object to extract the settings from
-
cb
ObjectA callback that provides two parameters: cb(error, TRUE/FALSE). TRUE if the settings were successfully cleared and reloaded. FALSE if not.
resetThemeSettings
-
details
-
cb
Loads the Theme settings from a details object and persists them in the DB. Any existing theme settings for the plugin are deleted before the new settings are persisted. If the plugin does not have a theme then false is provided in the callback.
Parameters:
-
details
ObjectThe details object to extract the settings from
-
cb
ObjectA callback that provides two parameters: cb(error, TRUE/FALSE). TRUE if the settings were successfully cleared and reloaded. FALSE if not.
setSetting
-
name
-
value
-
pluginName
-
cb
Replaces a single setting for the specified plugin
Parameters:
-
name
ObjectThe name of the setting to change
-
value
ObjectThe new value for the setting
-
pluginName
ObjectThe plugin who's setting is being changed.
-
cb
ObjectA callback that provides two parameters: cb(error, TRUE/FALSE). TRUE if the setting was persisted successfully, FALSE if not.
setSettings
-
settings
-
pluginName
-
cb
Replaces the settings for the specified plugin.
Parameters:
-
settings
ObjectThe settings object to be validated and persisted
-
pluginName
ObjectThe name of the plugin who's settings are being represented
-
cb
ObjectA callback that provides two parameters: cb(error, TRUE/FALSE). TRUE if the settings were persisted successfully, FALSE if not.
setThemeSetting
-
name
-
value
-
pluginName
-
cb
Replaces a single theme setting for the specified plugin
Parameters:
-
name
ObjectThe name of the setting to change
-
value
ObjectThe new value for the setting
-
pluginName
ObjectThe plugin who's setting is being changed.
-
cb
ObjectA callback that provides two parameters: cb(error, TRUE/FALSE). TRUE if the setting was persisted successfully, FALSE if not.
setThemeSettings
-
settings
-
pluginName
-
cb
Replaces the theme settings for the specified plugin.
Parameters:
-
settings
ObjectThe settings object to be validated and persisted
-
pluginName
ObjectThe uid of the plugin who's settings are being represented
-
cb
ObjectA callback that provides two parameters: cb(error, TRUE/FALSE). TRUE if the settings were persisted successfully, FALSE if not.
Properties
caching
Object
GLOBAL_SITE
String
private
static
pluginSettingsService
SimpleLayeredService
A setting service that sets and retrieves the settings for plugins
pluginSettingsService
SimpleLayeredService
A setting service that sets and retrieves the settings for plugins