internal package
Foswiki::Prefs
On this page:
- internal package Foswiki::Prefs
- ClassMethod new( $session )
- ObjectMethod finish()
- ObjectMethod loadPreferences( $topicObject ) → $back
- ObjectMethod pushTopicContext( $web, $topic )
- ObjectMethod setPluginPreferences( $web, $plugin )
- ObjectMethod setUserPreferences( $wikiname )
- ObjectMethod loadDefaultPreferences()
- ObjectMethod loadSitePreferences()
- ObjectMethod setSessionPreferences( %values )
- ObjectMethod setInternalPreferences( %values )
- ObjectMethod getPreference( $key ) → $value
- ObjectMethod stringify([$key]) → $text
internal package
Foswiki::Prefs
Preferences are set in topics, using either 'Set' lines embedded in the
topic text, or via PREFERENCE meta-data attached to the topic. A preference
value has four scopes: - Global scope
- Local scope
- Web scope
- Topic scope
ClassMethod
new( $session )
Creates a new Prefs object.
ObjectMethod
finish()
Break circular references.
ObjectMethod
loadPreferences( $topicObject ) → $back
Invoked from Foswiki::Meta to load the preferences into the preferences
cache. used as part of the lazy-loading of preferences.
Web preferences are loaded from the {WebPrefsTopicName}.
ObjectMethod
pushTopicContext( $web, $topic )
Reconfigures the preferences so that general preference values appear
to come from $web.$topic. The topic context can be popped again using
popTopicContext.
popTopicContext()
Returns the context to the state it was in before thepushTopicContext
was last called.
ObjectMethod
setPluginPreferences( $web, $plugin )
Reads preferences from the given plugin topic and injects them into
the plugin preferences cache. Preferences cannot be finalised in
plugin topics.
ObjectMethod
setUserPreferences( $wikiname )
Reads preferences from the given user topic and pushes them to the preferences
stack.
ObjectMethod
loadDefaultPreferences()
Add default preferences to this preferences stack.
ObjectMethod
loadSitePreferences()
Add local site preferences to this preferences stack.
ObjectMethod
setSessionPreferences( %values )
Set the preference values in the parameters in the SESSION stack.
ObjectMethod
setInternalPreferences( %values )
Designed specifically for imposing the value of preferences on a short-term
basis in the code, internal preferences override all other definitions of
the same tag. This function should be used with great care.
For those who are used to the old code, internal preferences replace the old
SESSION_TAGS field from the Foswiki object.
ObjectMethod
getPreference( $key ) → $value
- =$key - key to look up