Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-03-07 09:26:41

Bender
Member
From: Czech Republic
Registered: 2005-11-01
Posts: 23
Website

Tab and subtab

Hello,

how can I add subtab under my new tab? Problem: I writting a plugin with much options and “categories” and I want keep it well-arranged.

I need add new tab under extensions (with register_tab();) and “subtab” under this new tab. I don´t know how. Exactly like MLP plugin.

Please, can anyone give me a little help?

Thanks!

Offline

#2 2008-03-07 10:47:18

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Tab and subtab

Look at the source code of the MLP plugin.

Offline

#3 2008-03-07 11:33:23

Bender
Member
From: Czech Republic
Registered: 2005-11-01
Posts: 23
Website

Re: Tab and subtab

Hi ruud,

thank you for quick answer.

I looked at source MLP, but it´s very complicated.

There is:

if ($parent_tab) { register_tab($parent_tab, $event, $title); register_callback(array(&$this, 'render'), $event, null, 0); }

When I find solution, I will post it here.

Thank you again.

Offline

#4 2008-03-07 14:35:19

graeme
Plugin Author
Registered: 2004-06-21
Posts: 337
Website

Re: Tab and subtab

MLP uses my gbp_admin_library (as does gbp_permanent_links). The library handles the subtabs the basic of gbp_permanent_links are as follows:

class PermanentLinks extends GBPPlugin
{
	var $preferences = array(
		'preference_name' => array('value' => 'default_value', 'type' => 'text_input'),
	);

	function preload()
	{
		new PermanentLinksListTabView('list', 'list', $this);
		new PermanentLinksBuildTabView('build', 'build', $this);
		new GBPPreferenceTabView($this);
	}
}

class PermanentLinksBuildTabView extends GBPAdminTabView
{
	function main()
	{
		// output tab html
	}
}

class PermanentLinksListTabView extends GBPAdminTabView
{
	function main()
	{
		// output tab html
	}
}

new PermanentLinks('Permanent Links', 'permlinks', 'admin');

Note: GBPPreferenceTabView takes the $preferences array and automatically output a preference table. MLP also uses GBPWizardTabView which generates the wizard which you can see when you first install MLP.

Last edited by graeme (2008-03-07 14:39:11)

Offline

Board footer

Powered by FluxBB