PluginSettingService Class
Constructor for service that retrieves plugin settings from the database.
Constructor
PluginSettingService
-
siteUID
Parameters:
-
siteUIDString- 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.objTypeStringThe type of object that will be dealt with. (plugin_settings, theme_settings)
-
opts.useMemoryBooleanIndicates if the generated layered service should use an in memory service.
-
opts.useCacheBooleanIndicates if the generated layered service should use a cache service.
-
opts.serviceNameStringThe name of the service
-
opts.siteString -
opts.onlyThisSiteBoolean
Returns:
getAdminPluginSettingsService
-
self
Parameters:
-
selfPluginSettingService
Returns:
getAdminThemeSettingService
-
self
Parameters:
-
selfPluginSettingService
Returns:
getSetting
-
settingName -
pluginName -
cb
Retrieves a single setting for the specified plugin.
Parameters:
-
settingNameStringThe name of the setting to retrieve
-
pluginNameStringThe name of the plugin who owns the setting
-
cbFunctionA 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:
-
pluginNameStringThe name of the plugin who's settings are being requested
-
cbFunctionA 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:
-
pluginNameString- name of plugin to retrieve settings for
-
cbFunction- 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:
-
pluginNameStringThe unique ID of the plugin who settings are to be retrieved
-
cbFunctionA 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:
-
settingNameObjectThe uid of the setting
-
pluginNameObjectThe plugin to retrieve the setting from
-
cbObjectA callback that provides two parameters: cb(error, settingValue)
getThemeSettings
-
pluginName -
cb
Retrieves the theme settings for the specified plugin
Parameters:
-
pluginNameObjectThe uid of the plugin
-
cbObjectA 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:
-
pluginNameString- the name of the plugin to get theme settings
-
cbFunction- 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:
-
pluginNameStringThe unique ID of the plugin who settings are to be retrieved
-
cbFunctionA callback that takes two parameters. A error, if exists, and a hash of of the plugin's settings' names/values.
purgePluginSettings
-
pluginUid -
cb
Parameters:
-
pluginUidString -
cbFunction
purgeThemeSettings
-
pluginUid -
cb
Parameters:
-
pluginUidString -
cbFunction
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:
-
detailsObjectThe details object to extract the settings from
-
cbObjectA 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:
-
detailsObjectThe details object to extract the settings from
-
cbObjectA 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:
-
nameObjectThe name of the setting to change
-
valueObjectThe new value for the setting
-
pluginNameObjectThe plugin who's setting is being changed.
-
cbObjectA 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:
-
settingsObjectThe settings object to be validated and persisted
-
pluginNameObjectThe name of the plugin who's settings are being represented
-
cbObjectA 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:
-
nameObjectThe name of the setting to change
-
valueObjectThe new value for the setting
-
pluginNameObjectThe plugin who's setting is being changed.
-
cbObjectA 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:
-
settingsObjectThe settings object to be validated and persisted
-
pluginNameObjectThe uid of the plugin who's settings are being represented
-
cbObjectA 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
