2014-08-27, 03:04 PM
Instead of the current method of forcing plugins to hackily go in and beat at the templates and hope their edits fit, perhaps add in a new template and a hook that lets plugins not have to worry about that?
I was thinking something like this:
Most likely someone will come up with better names for all this...
This would necessitate adding the "header_menu_item" template (basically a generic version of one of the existing menu templates).
This would allow plugins to add themselves to the header menu without resorting to potentially fragile template modifications (i.e. what if the header template had <nav><a...>... instead of the current <ul><li><a...>...).
I was thinking something like this:
$toplinks = array(
array('class' => "help", 'link' => "{$mybb->settings['bburl']}/misc.php?action=help", 'content' => "$lang->toplinks_help"));
// conditional stuff for adding the other things
$plugins->run_hooks('global_header_menu', &$toplinks);
$headermenu = '';
foreach($toplinks as $link)
{
$headermenu .= eval($templates->render("header_menu_item"));
}
// continue as normal
Most likely someone will come up with better names for all this...
This would necessitate adding the "header_menu_item" template (basically a generic version of one of the existing menu templates).
This would allow plugins to add themselves to the header menu without resorting to potentially fragile template modifications (i.e. what if the header template had <nav><a...>... instead of the current <ul><li><a...>...).