API Docs for: 0.8.0
Show:

PluginSettingService Class

Constructor for service that retrieves plugin settings from the database.

Constructor

PluginSettingService

(
  • siteUID
)

Parameters:

  • siteUID String
    • site unique id

Methods

genSettingsService

(
  • opts.objType
  • opts.useMemory
  • opts.useCache
  • opts.serviceName
  • opts.site
  • opts.onlyThisSite
)
SimpleLayeredService static

Convenience function to generate a service to handle settings for a plugin.

Parameters:

  • opts.objType String

    The type of object that will be dealt with. (plugin_settings, theme_settings)

  • opts.useMemory Boolean

    Indicates if the generated layered service should use an in memory service.

  • opts.useCache Boolean

    Indicates if the generated layered service should use a cache service.

  • opts.serviceName String

    The name of the service

  • opts.site String
  • opts.onlyThisSite Boolean

getAdminPluginSettingsService

(
  • self
)
SimpleLayeredService private static

Parameters:

getAdminThemeSettingService

(
  • self
)
SimpleLayeredService private static

Parameters:

getSetting

(
  • settingName
  • pluginName
  • cb
)

Retrieves a single setting for the specified plugin.

Parameters:

  • settingName String

    The name of the setting to retrieve

  • pluginName String

    The name of the plugin who owns the setting

  • cb Function

    A 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 String

    The name of the plugin who's settings are being requested

  • cb Function

    A 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 String

    The unique ID of the plugin who settings are to be retrieved

  • cb Function

    A 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 Object

    The uid of the setting

  • pluginName Object

    The plugin to retrieve the setting from

  • cb Object

    A callback that provides two parameters: cb(error, settingValue)

getThemeSettings

(
  • pluginName
  • cb
)

Retrieves the theme settings for the specified plugin

Parameters:

  • pluginName Object

    The uid of the plugin

  • cb Object

    A 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 String

    The unique ID of the plugin who settings are to be retrieved

  • cb Function

    A 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 Object

    The details object to extract the settings from

  • cb Object

    A 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 Object

    The details object to extract the settings from

  • cb Object

    A 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 Object

    The name of the setting to change

  • value Object

    The new value for the setting

  • pluginName Object

    The plugin who's setting is being changed.

  • cb Object

    A 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 Object

    The settings object to be validated and persisted

  • pluginName Object

    The name of the plugin who's settings are being represented

  • cb Object

    A 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 Object

    The name of the setting to change

  • value Object

    The new value for the setting

  • pluginName Object

    The plugin who's setting is being changed.

  • cb Object

    A 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 Object

    The settings object to be validated and persisted

  • pluginName Object

    The uid of the plugin who's settings are being represented

  • cb Object

    A callback that provides two parameters: cb(error, TRUE/FALSE). TRUE if the settings were persisted successfully, FALSE if not.

Properties

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

SITE_FIELD

String private static