Now the standard is:
Main Settings -- Stylesheet -- Config -- Language -- Help
Would be nice, if more items could be added, at least --about--, sometimes something like --preview-- would also make sense.
More items in print_plugin_admin?
Re: More items in print_plugin_admin?
Well, print_plugin_admin() builds up the items automatically from what is there (stylesheet, config file, language file, help file); there is only a single option that can be controlled by the developer: whether the "Main Settings" will be shown. However, print_plugin_admin() is just a facade for pluginMenu(), which could be used directly. And it is possible to add another row with menu items, e.g. (from Register_XH):
Basically, I neither like the way the menus are marked up as tables (a list would be more flexible), nor do I like the procedural interface which is clumsy and overly flexible.
And since XH 1.6.2 there is XH_registerPluginMenuItem and its facade XH_registerStandardPluginMenuItems, which really serves the same purpose.
Even though XH_registerPluginMenuItem() offers far less flexibility than pluginMenu(), it seems to me the API is sufficient. So what about the following idea?
Code: Select all
$o .= print_plugin_admin('off');
pluginmenu('ROW');
pluginmenu('TAB', '?®ister&admin=plugin_main&action=editgroups', '', $plugin_tx[$plugin]['mnu_group_admin']);
pluginmenu('TAB', '?®ister&admin=plugin_main&action=editusers', '', $plugin_tx[$plugin]['mnu_user_admin']);
$o .= pluginmenu('SHOW');
And since XH 1.6.2 there is XH_registerPluginMenuItem and its facade XH_registerStandardPluginMenuItems, which really serves the same purpose.
Even though XH_registerPluginMenuItem() offers far less flexibility than pluginMenu(), it seems to me the API is sufficient. So what about the following idea?
Code: Select all
function print_plugin_admin($main)
{
if (hasRegisteredItems($plugin)) {
// emit plugin menu with all registered menu items
} else {
// emit plugin menu as it is now
}
}
Christoph M. Becker – Plugins for CMSimple_XH
Re: More items in print_plugin_admin?
I played around a bit with XH_registerPluginMenuItem, but it is not really necessary for my plugins. It's fine for plugins which have the "about" as plugin_main. But it makes for a complicated plugin dropdown menu.
What about a setting so that XH_registerPluginMenuItem don't create an additional plugin dropdown menu but an additional item in the print_plugin_admin without adding another row?
What about a setting so that XH_registerPluginMenuItem don't create an additional plugin dropdown menu but an additional item in the print_plugin_admin without adding another row?
Re: More items in print_plugin_admin?
I didn't mean to suggest that you solely use the new plugin menu, but that instead both plugin menus could be build from XH_registerPluginMenuItem(). You may try the following draft replacement of print_plugin_admin();svasti wrote:I played around a bit with XH_registerPluginMenuItem, but it is not really necessary for my plugins.
Code: Select all
function print_plugin_admin($main)
{
global $plugin, $_XH_pluginMenu;
initvar('action');
initvar('admin');
$items = XH_registerPluginMenuItem($plugin);
if ($items) {
$html = '<ul style="list-style:none; padding-left:0; margin-bottom:1em">';
foreach ($items as $item) {
$html .= '<li style="float:left; padding-right:1em">'
. '<a href="' . XH_hsc($item['url']) . '">'
. XH_hsc($item['label']) . '</a>'
. '</li>';
}
$html .= '<div style="clear:left"></div>' . '</ul>';
return $html;
} else {
return $_XH_pluginMenu->render(strtoupper($main) == 'ON');
}
}
And it lets the user quickly access the help file, for instance, so he could look up the syntax of the plugin call.svasti wrote:It's fine for plugins which have the "about" as plugin_main. But it makes for a complicated plugin dropdown menu.
We have to consider small content areas; adding another cell to the plugin menu could easily bust the layout--actually that might already happen, particularly when the user is using long labels for the menu items. You can see a relatively harmless, but IMO unpleasant, effect, when requesting Pagemanager's administration in Responsivehtml, for instance.svasti wrote:What about a setting so that XH_registerPluginMenuItem don't create an additional plugin dropdown menu but an additional item in the print_plugin_admin without adding another row?
Christoph M. Becker – Plugins for CMSimple_XH