there was a quite large thread about this topic more than a year ago: http://cmsimpleforum.com/viewtopic.php?f=29&t=3224 -- unfortunately without any solution. In the meantime the topic popped up more than once [1], so IMO it's time to find and finally implement a solution. Please note that I'm not taking about the configuration of plugins only, but about the configuration of the core too.
In the past I've experimented with several solutions, but none of them would have been completely backward compatible. But now I figured out a solution, that should be easy to implement (for core and pluginloader), simple to use for plugin developers and that would work for older variants/versions of CMSimple and the pluginloader too.
The idea is having an additional file for each config.php that contains meta information about the entries. The file is necessary only to build and save the configuration form, so it will not hurt general performance. Of course it could be ignored completely -- by non-conforming variants/versions of CMSimple/Pluginloader and by plugin developers who don't need/want it.
I'll try to explain what I mean with an example based on a fictious plugin:
Code: Select all
<?php
$plugin_cf['fictious']['enable']="true";
$plugin_cf['fictious']['count']="123";
$plugin_cf['fictious']['title']="Fictious";
$plugin_cf['fictious']['message']="This is the fictious Fictious plugin.";
$plugin_cf['fictious']['password']="abcdefg";
$plugin_cf['fictious']['theme']="default";
$plugin_cf['fictious']['options']="small,simple,smart";
?>
Code: Select all
<?php
$plugin_mcf['fictious']['enable']="bool";
$plugin_mcf['fictious']['count']="number";
$plugin_mcf['fictious']['title']="string";
$plugin_mcf['fictious']['message']="text";
$plugin_mcf['fictious']['password']="password";
$plugin_mcf['fictious']['theme']="select:default,red,green,blue";
$plugin_mcf['fictious']['options']="multi-select:small,simple,smart,standard-conforming,fast";
?>
- bool: a checkbox
- number: an input type="text" (or for HTML5 an input type="number")
- string: an input type="text"
- text: a textarea
- password: an input type="password"
- select: a selectbox or radio buttons
- multi-select: a selectbox or checkboxes
Any comments, suggestions and improvements are welcome!
Christoph
PS: [1]