pass a variable from addon config function calls

Posts from previous Beta sessions

pass a variable from addon config function calls

Postby Vlorn » Tue Nov 06, 2007 4:10 pm

Within the addon config section we can define a function call, in this case I'm pulling a list of forum groups.
Code: Select all
function{name
Calls the function called name with the option record as parameter to produce the HTML for the option.
$installer->add_config("'4270', 'left_text', 'VERANDA.TTF', 'function{fontFiles', 'menu_conf_top'")

Can we pass a value to the function?

For simplicities sake I'd like to be able to use the same config function twice, and have it update the select list based on the menu item thats calling the function.

IE
Code: Select all
$installer->add_config("'1320','guild_suspend_group','0','function{getForumList(guild_suspend_group)','nuke_menu_guild'");
$installer->add_config("'1430','guild_protected_group','0','function{getForumList(guild_protected_group)','nuke_menu_create'");

Then my function could make changes based on the menu item that called it.
-Vlorn
User avatar
Vlorn
WR.net Apprentice
WR.net Apprentice
 
Posts: 29
Joined: Tue Jul 04, 2006 7:57 pm

pass a variable from addon config function calls

Postby PleegWat » Tue Nov 06, 2007 4:19 pm

The function gets passed a record containing everything from the DB record for that option, and the label/description text for that option in the active language.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

pass a variable from addon config function calls

Postby PleegWat » Tue Nov 06, 2007 7:16 pm

Addition: If you want to pass function parameters from the form_type, rather than switching on the config name, you can use the following structure:

function{name{arguments

Everything after the second { will be ignored by the config framework. You can find the full string in the array that is passed to your function, under 'form_type'
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm


Return to Archived

Who is online

Users browsing this forum: No registered users and 1 guest

cron