EasySettings

y2kbgy2kbg New
edited January 2007 in Vanilla 1.0 Help
EasySettings
This extension allows you to add on/off Toggle Settings to an extension with ease.
For Extension Users:
You must have this extension enabled before any extension that requires this extension.
For Extension Developers:
To use this extension to add on/off settings to a nice admin area for your extension use a block of code such as this:
if ($Context->SelfUrl == "settings.php" && $Context->Session->User->Permission('PERMISSION_CHANGE_APPLICATION_SETTINGS') && array_key_exists('Friends_Settings_V', $Configuration)) { $FriendsSettings = $Context->ObjectFactory->NewContextObject($Context,'EasySettingsForm'); $FriendsSettings->ExtensionName = 'Friends'; $FriendsSettings->AddAnEasySetting('AllowGuests'); $FriendsSettings->AddAnEasySetting('Request'); $FriendsSettings->AddAnEasySetting('PeoplesTab'); $FriendsSettings->AddEasySettingHeader('Select the Columns you would like to display:'); $FriendsSettings->AddAnEasySetting('NameCell'); $FriendsSettings->AddAnEasySetting('DateRegistered'); $FriendsSettings->AddAnEasySetting('MemberIcons'); $FriendsSettings->AddAnEasySetting('VisitCount'); $FriendsSettings->AddAnEasySetting('Email'); $FriendsSettings->AddAnEasySetting('PostCount'); $FriendsSettings->AddAnEasySetting('Role'); $FriendsSettings->MakeStart($Context); $Page->AddRenderControl($FriendsSettings,$Configuration["CONTROL_POSITION_BODY_ITEM"] + 1); $Panel->AddList('Extension Options', 10); $Panel->AddListItem('Extension Options',$FriendsSettings->ExtensionName.' Settings',GetUrl($Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction='.$FriendsSettings->ExtensionName)); }
Now you need to understand how to make this suit you.
First pick a name that will be unique to initiate the class. in my I case I used $FriendsSettings

Start with this, and replace everything that says $FriendsSettings with the name you picked.
if ($Context->SelfUrl == "settings.php" && $Context->Session->User->Permission('PERMISSION_CHANGE_APPLICATION_SETTINGS') && array_key_exists('Friends_Settings_V', $Configuration)) { $FriendsSettings = $Context->ObjectFactory->NewContextObject($Context,'EasySettingsForm'); $FriendsSettings->MakeStart($Context); $Page->AddRenderControl($FriendsSettings,$Configuration["CONTROL_POSITION_BODY_ITEM"] + 1); $Panel->AddList('Extension Options', 10); $Panel->AddListItem('Extension Options',$FriendsSettings->ExtensionName.' Settings',GetUrl($Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction='.$FriendsSettings->ExtensionName)); }
Now directly before $YourChoosenName->MakeStart($Context); you can add settings and sub headers.
To add a setting:
$YourChoosenName->AddAnEasySetting('AllowGuests');
To add a header:
$YourChoosenName->AddEasySettingHeader('Select the Columns you would like to display:');

I hope that this has cleared thing up on how to use this this.

Comments

  • Before I even try and use this... might want to rip untitled.bmp out of the download as it is 284KB, which is a bit much!
This discussion has been closed.