Skip to content
Randy Merrill edited this page Jan 28, 2011 · 5 revisions

Defining Settings

Plugin settings are read from the settings files on application initialization or reinitialization.

The default settings for plugins are found in the plugins/<plugin key>/config/project.json.cfm file. They can also be overridden in the plugins/<plugin key>/config/settings.json.cfm file.

Custom settings can be added by adding to the project.json.cfm or settings.json.cfm file. Additionally complex plugin settings can be accomplished using the [[onApplicationStart hook|Plugins: Life Cycle]] or the config/configure.cfc component.

The following are the base settings that every plugin should have available.

Setting Description Default
applicationSingletons Application singleton definitions. {}
applicationTransients Application transient definitions. {}
i18n Internationalization settings.
i18n.locales Available locales for the application. [ "en_US" ]
key Unique plugin key. @key@
prerequisites Prerequisite plugins or projects. {}
requestSingletons Request singleton definitions. {}
requestTransients Request transient definitions. {}
sessionSingletons Session singleton definitions. {}
sessionTransients Session transient definitions. {}
version Plugin version. 0.1.0

@key@ = unique plugin key

Using Settings

To access a plugin's settings you must first retrieve the plugin singleton.

// Retrieve the plugin singleton from the plugin manager
content = transport.theApplication.managers.plugin.getContent();

Once you have retrieved the singleton it is as simple as retrieving the setting.

// Retrieve the setting from the content
version = content.getVersion();
Clone this wiki locally