Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

settingsURL + displaying a plugin settings page

edited May 2011 in Vanilla 2.0 - 2.8
I've realised through hacking the code that adding a settingsUrl parameter to the $PluginInfo array gives me a settings button on the main plugins list.

However, I don't know how to link this to a settings page, and once there, permanently save settings. I've looked at some of the other plugins that use settings, but they all appear to be different, and no matter how many different files in the plugin "views" folder I try, I cannot seem to link to a page / view fragment.

Is there some kind of tutorial / documentation for this?

All I want to do is to list some files in a folder, then allow the user to store a single filename for use in the plugin when it runs.

Thanks,
Dave
Tagged:

Comments

  • ToddTodd Vanilla Staff
    edited May 2011
    I'm going to recommend you give something a try that is new in 2.0.18 called the ConfigurationModule. It helps you put together simple configuration pages.

    Here is an example from our Akismet plugin:
    public function SettingsController_Akismet_Create($Sender, $Args) {
    $Sender->SetData('Title', T('Akismet Settings'));

    $Cf = new ConfigurationModule($Sender);
    $Cf->Initialize(array('Plugins.Akismet.Key' => array('Description' => 'Enter the key you obtained from akismet.com')));

    $Sender->AddSideMenu('dashboard/settings/plugins');
    $Cf->RenderAll();
    }
    This code will take care of the displaying/loading/saving of the config code. You need to tell the module what config settings to load/save in its Initialize() method. If you want a drop down you would add this array element:
    $Filenames = array(); // get filenames here
    $Cf->Initialize(array('Plugins.YourPlugin.Setting => array('Control' => 'dropdown', 'Items' => $Filenames)));
    I'm going to document this code better and put up a help topic, but hopefully this can get you started.
  • ToddTodd Vanilla Staff
    edited May 2011
    And to answer your other question about getting your settings on the side menu. Here is an example from our pockets plugin:
    public function Base_GetAppSettingsMenuItems_Handler(&$Sender) {
    $Menu = $Sender->EventArguments['SideMenu'];
    $Menu->AddItem('Appearance', T('Appearance'));
    $Menu->AddLink('Appearance', T('Pockets'), 'plugin/pockets', 'Plugins.Pockets.Manage');
    }
  • Nice one Todd, I appreciate your response.

    Documentation would be great - but I know it can take a long time to do, so I'll hopefully get to look at this over the weekend.

    Cheers very much,
    Dave
  • Had a wee look, but I think I'll wait for the docs!
  • Hi,
    I'have written a plugin based on the code of the Proxyconnect plugin with my own authenticator. The problem is that I can not get the authenticator configuration page work.
    If I choose Proxyconnect authenticator, below the configuration page is displayed but when I change to my authenticator, nothing is displayed.
    I'm using Vanilla 2.0.18.1. Is it documente somewhere? Can you post some code to do it.
    Thanks.

  • mattmatt ✭✭

    Todd said:
    I'm going to recommend you give something a try that is new in 2.0.18 called the ConfigurationModule. It helps you put together simple configuration pages.

    I use this in my Mobile Search plugin, thanks @Todd for the hint (and for the Akismet plugin that shows how it's done)

Sign In or Register to comment.