accessing the plugin administration currently requires to select the plugin from the admin menu; only then the plugin menu is shown. So usually one needs two clicks (and and two requests!) to get to the desired functionality. This can be partly circumvented by presenting the main plugin administration as the first "screen", as can be seen in several of Frank's (aka. svasti) plugins. However, that doesn't help if the user wants to go to the configuration directly, for instance. Furthermore the pluginmenu on top of the contents area seems somewhat misplaced -- why not have it as part of the admin menu?
[ external image ]
That would require plugins to register the desired menu functionality similar to print_plugin_admin() and pluginMenu(), if the core offers something like XH_registerPluginMenuItem() and for convenience, XH_registerStandardPluginMenuItems(). These functions could simply be called from the admin.php of a plugin (unconditionally, opposed to print_plugin_admin(), which only should be called if the plugin is requested). A typical use case would be adding the following single line:
Code: Select all
XH_registerStandardPluginMenuItems(true);
Code: Select all
if (function_exists('XH_registerStandardPluginMenuItems')) {
XH_registerStandardPluginMenuItems(true);
}
if (isset($pagemanger) && $pagemanager == 'true') {
if (!function_exists('XH_registerStandardPluginMenuItems')) {
$o .= print_plugin_admin('on');
}
}
Code: Select all
/**
* Register a new plugin menu item, or returns the registered plugin menu items,
* if <var>$label</var> and <var>$url</var> are null.
*
* @param string $plugin A plugin name.
* @param string $label A menu item label.
* @param string $url A URL to link to.
*
* @return mixed
*
* @staticvar array $pluginMenu The array of already registered menu items.
*/
function XH_registerPluginMenuItem($plugin, $label = null, $url = null)
{
static $pluginMenu = array();
if (isset($label) && isset($url)) {
$pluginMenu[$plugin][] = array(
'label' => $label,
'url' => $url
);
} else {
return $pluginMenu[$plugin];
}
}
What do you think?
Christoph