r1 - 26 Feb 2003 - 13:40:00 - CrawfordCurrieYou are here: TWiki >  Plugins Web > AddOnsNeedVariablesToo
Tags:
, create new tag
I need a way to control the behaviour of an addon using addon-specific variables, similar to a plugin. So when my addon is unzipped, I want SOMEADDON_VARIABLE to be defined by virtue of the unzipping process. I then want to be able to override that value in WebPreferences and the user's personal topic, like a variable declared in TWikiPreferences.

I can obviously do it by asking the installer to manually edit TWikiPreferences as a post-install step, but I don't think that's very friendly. I could also do it by creating a Plugin with the same name, but that's nasty.

Anyone got any ideas?

If there's no way to do it today, how about some way to load a preferences object with a resolution chain? For example:

my $prefs = TWiki::Func::loadPreferences( "TWiki.SomeAddOn,TWiki.TWikiPreferences,%WEB%.WebPreferences,%MAINWEB%.$userName" );
my $var = $prefs->getPreferencesValue( "SOMEADDON_VARIABLE" );
This would of course necessitate publishing the Prefs class through Func; some would argue this is the way Func should be done anyway.

-- CrawfordCurrie - 26 Feb 2003

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo