I have recently added in serendipity_event_entrylastmodified plugin an improvement (at least I think so) to radio control selectors that appear in configuration forms (when installing a plugin). The idea is to set different number of options per line depending on the language. Some languages have shorter words than others, par example Bulgarian word are in general longer than English words. Thus while the radio control looks fine in English, in Bulgarian the selector labels wrap on next line.
Here is the code (from serendipity_event_entrylastmodified.php, part of introspect_config_item() function):
Code: Select all
case 'position':
$propbag->add('type','radio');
$propbag->add('name',PLUGIN_EVENT_ENTRYLASTMODIFIED_POSITION);
$propbag->add('description',PLUGIN_EVENT_ENTRYLASTMODIFIED_POSITION_DESC);
$propbag->add('radio',array(
'value' => array('left','center','right'),
'desc' => array(PLUGIN_EVENT_ENTRYLASTMODIFIED_LEFT,PLUGIN_EVENT_ENTRYLASTMODIFIED_CENTER,PLUGIN_EVENT_ENTRYLASTMODIFIED_RIGHT)
));
$propbag->add('default','right');
// languages for which options per row are 2, add your language if appropriate
$per_row_2 = array(1 => 'bg');
// languages for which options per row are 3, add your language if appropriate
$per_row_3 = array(1 => 'en');
$lang = $serendipity['lang'];
if (in_array($lang,$per_row_2) == true)
$per_row = 2;
else if (in_array($lang,$per_row_3) == true)
$per_row = 3;
else
$per_row = 1; // by default one option per row - for languages with very long words
unset($per_row_2, $per_row_3);
$propbag->add('radio_per_row', $per_row);
break;
Regards,