I am trying to add a simple select statment to my plugin's config, I looked at the code for serendipity_plugin_eventwrapper and, after sorting out what went into the array, copied it's way of adding a select.
this is the code I copied
Code: Select all
function introspect_config_item($name, &$propbag)
{
global $serendipity;
switch($name) {
case 'event_plugin':
$plugins = serendipity_plugin_api::get_event_plugins();
$select = array();
if (is_array($plugins)) {
foreach($plugins AS $plugname => $plugarray) {
$select[$plugname] = $plugarray['t'];
}
}
$propbag->add('type', 'select');
$propbag->add('name', PLUGIN_EVENT_WRAPPER_PLUGIN);
$propbag->add('description', PLUGIN_EVENT_WRAPPER_PLUGINDESC);
$propbag->add('select_values', $select);
break;
case 'title':
$propbag->add('type', 'string');
$propbag->add('name', TITLE);
$propbag->add('description', PLUGIN_EVENT_WRAPPER_TITLEDESC);
break;
default:
return false;
}
return true;
}
Code: Select all
function introspect_config_item($name, &$propbag) {
switch ($name) {
case 'title':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBAR_METAR_TITLE);
$propbag->add('description', PLUGIN_SIDEBAR_METAR_TITLE_BLAHBLAH);
break;
case 'metar':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBAR_METAR_SOURCE);
$propbag->add('description', PLUGIN_SIDEBAR_METAR_SOURCE_BLAHBLAH);
break;
case 'timezone':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SIDEBAR_METAR_TIMEZONE);
$propbag->add('description', PLUGIN_SIDEBAR_METAR_TIMEZONE_BLAHBLAH);
break;
case 'unitMeasure':
$select = array();
$select["metric"] = "Metric";
$select["standard"] = "Imperial/US Standard";
$propbag->add('type', 'select');
$propbag->add('name', PLUGIN_SIDEBAR_METAR_UNITS);
$propbag->add('description', PLUGIN_SIDEBAR_METAR_UNITS_BLAHBLAH);
$propbag->add('select_values', $select);
default:
return false;
}
return true;
}
Nikolai[/code]