Recent Topics

hook for adding pages to the backend?

Started by on Mar 11, 2006 – Contents updated: Mar 11, 2006

Mar 11, 2006 06:08    

Need a hook for adding pages to the backend, is there one and, if so, has anyone successfully done it so I can see an example?
I have a (simply)marvelous plugin idea :)

Mar 11, 2006 07:41

I just did an install of the latest and greatest from CVS. A beast that calls itself "1.8 CVS". It appears that there is not a hook for a 'top level' new tab, but you can add a subtab to the tools tab. I will PM you with a URL and login credentials so's you can see the impact of the test plugin.

Mar 11, 2006 09:25

I saw that .. :) thanks!!

oke so ..

inside test.php we have

/**
	 * Event handler: Called when displaying the tool menu.
	 *
	 * {@internal test_plugin::ToolMenu(-)}}
	 *
	 * @param array Associative array of parameters
	 * @return boolean did we display a toolbar?
	 */
	function ToolMenu( $params )
	{
		echo 'Hello, This is the ToolMenu for the TEST plugin.';
		return true;
	}
}

that might work for what I have in mind, it IS a tool, afterall... I will have to install this version this weekend and putz around

Mar 11, 2006 10:00

[quote]I have a (simply)marvelous plugin idea [/quote]

Has no one ever told yah that curiosity killed the cat? :|

¥

Mar 12, 2006 18:49

well shit!

I'm not too happy. I can add a "tool" to the tools page, but that presents a bit of problem with form submissions as tools.php?blah=blah doesnt return a valid page.

There REALLY needs to be a hook for adding standalone pages to the tabs. Consider this my official request, please.

As it stands, i have managed to add what I wanted by editing admin/_header.php and my extra page works, but still .. :( .... I really wanted this to NOT entail any file editing.

**
 * This is the Admin UI object which handles the UI for the backoffice.
 *
 * @global AdminUI
 */
$AdminUI = & new AdminUI();

// Construct the menu:
$AdminUI->add_menu_entries(
		NULL, // root
		array(
			'new' => array(
				'text' => T_('Write'),
				'href' => 'b2edit.php?blog='.$blog,
				'style' => 'font-weight: bold;'
			),

are we positive theres no "simple" way to call that function and add a tab via a plugin???

Mar 19, 2006 23:57

whoo, you can hook the AdminAfterMenuInit() event (create a function with that name) and call the helper method $this->register_menu_entry('your tab title').

See http://manual.b2evolution.net/CreatingPlugin#Tools_tab - which I've just created.

I've also just updated the test_plugin in CVS to fix its tab handling (Revision 1.25).

Mar 20, 2006 14:44

right on, ill take a looksee at that, thanks!

Mar 25, 2006 21:09

have my tab made.. the page is displaying.

One problem still exists.

I have a form that needs to be processed, and the result needs to be updated to that tabbed page. It doesnt seem to want to do that, clicking the update button returns nothing.

im using this right now to debug:


echo "<form action=\"http://www.village-idiot.org/path-to/blogs/admin.php?ctrl=tools&tab=plug_ID_25\" method=\"post\">\n";

I can remove all the necessary code from the function, and paste it over to a standalone php page, and the form works successfully (assuming I change the action, of course)

Ideas?

also, im assuming that plug_id isnt static, whats the proper way to make that work for any setup?

Mar 25, 2006 23:25


// TODO: this is tedious.. should either be a global function (get_admin_Form()) or a plugin helper..
		$Form = new Form();
		$Form->begin_form();
		$Form->hidden_ctrl(); // needed to pass the "ctrl=tools" param
		$Form->hiddens_by_key( get_memorized() ); // needed to pass all other memorized params, especially "tab"

		$Form->text_input( $this->get_class_id().'_text', $this->param_text, '20', 'Text' );

		$Form->button_input(); // default "submit" button

		$Form->end_form();

thats great, however that doent explain how to integrate that into code that already exists. and where are those functions explained?

ill go paste that into another plugin and see what happens, my test plugin is long overwritten

[color=red]edit[/color]: ok, i can figure this out with that, thanks!


Form is loading...

Build your own site! – This forum is powered by b2evolution CMS, a complete engine for your website.