Recent Topics

[SOLVED] A way to split plugin settings into visual groups

Started by on Mar 02, 2008 – Contents updated: Mar 02, 2008

Mar 02, 2008 21:02    

Kinda like how the Global settings and Blog settings tabs have lots of stuff to click on but they are broken up into groups with a group heading? I think it would be cool if we could do that with plugin settings. Probably because I like to put too many settings into a plugin yah? 2.4.* of course. Everything else is just not 2.4.* ;)

A specific example would be my Turing Test plugin. Way too many settings that are all very similar but affect different bits of the whole. So I wish I could have grouped them for "General" then "Comments / Message Forms" then "Registration". Heck if I could have done that I'd have split comments and message forms in half.

Another one is the upcoming "tiny random youtubes" plugin. All the settings will work, and will really enhance the flexibility, but it will be confusing because they won't be 'nicely grouped' to help the admin figure out what the heck is going on.

Mar 02, 2008 22:28

You can group them within fieldsets, maybe not ideal, but visually separates them :

/**
* Get definitions for widget specific editable params
*
* @see Plugin::GetDefaultSettings()
* @param local params like 'for_editing' => true
*/
function get_widget_param_definitions( $params )
{
$r = array(
'quick_start' => array(
'label' => T_('Quick settings'),
'layout' => 'begin_fieldset',
),
'feed_url' => array(
'label' => T_('Feed url'),
'defaultvalue' => 'http://',
'note' => T_('This is the url of the feed you wish to display'),
'type' => 'text',
'size' => 40,
),
'feed_limit' => array(
'label' => T_('Limit'),
'defaultvalue' => 5,
'note' => T_('This is the max number of feed entries to display'),
'type' => 'text',
'size' => 2,
),
'cache_lifetime' => array(
'label' => T_('Cache'),
'defaultvalue' => 60,
'note' => T_('This is the time, in minutes, to cache the feed results for'),
'type' => 'text',
'size' => 4,
),
'quick_end' => array(
'layout' => 'end_fieldset',
),
'advanced_start' => array(
'label' => T_('Advanced settings'),
'layout' => 'begin_fieldset',
),

/me disables similes for post :roll: => :|

¥

Mar 02, 2008 22:50

cool - looks good. Will implement pretty darned quick.

Mar 03, 2008 02:22

Yeah I like that. Also, given a bit of a head start, I discovered by reading that I can have what looks like a plain old <hr /> in there with

'a_new_thing' => array(
	'layout' => 'separator',
	),

But I like the odd-looking-but-helpful "'layout' => 'begin_fieldset'," much morer.

One day I oughta publish the three cheat sheets I pulled from the comments in the code ... then maybe learn all there is to learn from 'em.


Form is loading...

Free CMS – This forum is powered by b2evolution CMS, a complete engine for your website.