turnermm wrote
As far as I can tell, the template author must use the pre-established menu types, and plugin authors must hook into one of these to enable a link or button.
Should use. By using the pre-established menu types, the template author ensures that plugins can easily hook into these menus without known any specifics of that template. Eg. the PDF export does not need to know how the bootstrap3 template integrates the link to export a page. It simply registers a MenuItem for the PageMenu.
Now, a template author could decide to do something fancy. Eg. Instead of having a single PageMenu, the author could decide to iterate over the items in that menu and split it into two sets of items: one set for known actions that should be prominently displayed and another for the rest.
turnermm wrote
But there seems to be no way for a template to register a new menu type, independent of site, user, page, or mobile.
They could. A template has it's own namespace. A template author could create a new Menu inheriting from AbstractMenu and put their own set of Items in it. The getItems() method in it would trigger a custom MENU_ITEMS_ASSEMBLY event with a new $view that plugin authors could use to target this specific template (how many plugin authors would do so is another question). This new custom defined Menu can be used by the template author just like any of the four predefined ones.
What this template does, is modifying the existing menus by basically implementing an action plugin component within the template it self. There is a lot else going on, but the basic gist is this:
* define your own namespaced class in the template, just to encapsulate everything neatly (
Template.php)
* in that class' constructor register a new handler on the MENU_ITEMS_ASSEMBLY event (
Template.php#L33)
* define your own method handling that event, in this case we empty the menu for anonymous users, but we could also add our own MenuItems here
Template.php#L78
* ensure this new class is instantiated immediately when the template is loaded
main.php (the same is in detail.php and mediamanager.php)
The same emchanism can be used to execute template code on nearly any DokuWiki event you want.
turnermm wrote
In the old system, it was possible to place a link or set of links anywhere in the template using the TEMPLATE_<name>_DISPLAY hook.
I'm not sure to which event you're referring to here. Do you mean TEMPLATE_PAGETOOLS_DISPLAY et al? That has been replaced by the four menu types. But yes, you can no longer emit arbitrary HTML in those. But doing so was probably bad style before as well.
Hope this clears stuff up a little. The how to trigger actions from Template code might be worth adding to the docs maybe.