Feng Forum

Other Topics => Development => : Kareed March 14, 2016, 03:02:12 AM

: How to setup parameter input for a plugin?
: Kareed March 14, 2016, 03:02:12 AM
Hi,
I want to start playing with making plugins.  I have created a tab to display a external webpage but I would like to have the website configurable from the settings panel without it being hard coded into the plugin.  How would I go about doing that?  I can't find any information on adding this type of capability.

Thanks
Kareed
: Re: How to setup parameter input for a plugin?
: conrado March 15, 2016, 02:48:59 PM
Hi Kareed,

Please do share the info here once you figure it out.

I have seen others do it so it shouldn't be too hard.

Cheers!
: Re: How to setup parameter input for a plugin?
: Kareed March 18, 2016, 01:50:55 AM
I figured it out and it was easy.  It just took a long time to figure that out.

All you need to do is add a new value into the config_options table.  The category name appears to be where the item will show in the settings.  I used general and it showed up under the general settings.  Create a name for the variable, I used timeclock_url.  Specify the type of interface, I used StringConfigHandler to get a textfield.  The text for the field is specified in the language lang.php file.

I was adding a timeclock tab so in the lang.php file I put the following information.
   'config option name timeclock_url'=>'Time Clock URL',
   'config option desc timeclock_url'=>'Enter in the url for the timeclock.',

I created a file mysql_initial_data.php in the folder install/sql to add the config_options entry on the installation of the plugin.  This file added the entry to the database.

Hope this helps.
: Re: How to setup parameter input for a plugin?
: conrado April 13, 2016, 04:44:35 PM
I am sure it will help many others.

Just FYI: Feng Office has a time tab for time tracking, and a clock for tasks on the tasks tab. I don't know if you mean that when you say you added a "timeclock" tab.

Cheers!