Hi,
I'm trying to add a link for the move plugin to my user tools menu. I have done this before on another dokuwiki install by adding the following to main.php inside the template (a Twenty Fifteen reworking):
<?php
//get the pagetools menu
$html = (new \dokuwiki\Menu\PageMenu())->getListItems('', false);
//create a new DOM Document and load the html contents into the DOM
$xml = new DOMDocument();
$xml->loadHTML($html);
//empty array to reordered menu
$result = array();
//loop through each <li> tag
foreach($xml->getElementsByTagName('li') as $li)
{
//get the tags innerhtml and the html
$name = $li->nodeValue;
$result[$name] = $xml->saveHTML($li);
//if the current name is Rename Page
if ($name == "Rename Page")
{
//add a menu item for Move Page
$result["Move Page"] = '<li><a href="http://mysite.com/notebook/doku.php?id=start&do=admin&page=move_main">Move Page</a></li>';
}
}
//loop through $result
foreach($result as $li) echo $li;
?>
This was three years ago, I undertand what's going on but actually can't find where "Rename Page" is referring to on that dokuwiki. I thought it was supposed to be in /inc/Menu/PageMenu.php
but it's not.
Anyway, I'm trying to do the same thing on another dokuwiki with a different template (based on writr). If I understand correctly this is an older template and it uses the tpl_toolsevent()
function to build the menu like so (so the solution above seems not to be possible):
<?php
tpl_toolsevent('pagetools', array(
'edit' => tpl_action('edit', 1, 'li', 1, '<span class="icon"></span> <span class="a11y">', '</span>'),
'revisions' => tpl_action('revisions', 1, 'li', 1, '<span class="icon"></span> <span class="a11y">', '</span>'),
'backlink' => tpl_action('backlink', 1, 'li', 1, '<span class="icon"></span> <span class="a11y">', '</span>'),
'subscribe' => tpl_action('subscribe', 1, 'li', 1, '<span class="icon"></span> <span class="a11y">', '</span>'),
'revert' => tpl_action('revert', 1, 'li', 1, '<span class="icon"></span> <span class="a11y">', '</span>'),
'Move' => tpl_action('Move', 1, 'li', 1, '<span class="icon"></span> <span class="a11y">', '</span>'), //this was my attempt
'top' => tpl_action('top', 1, 'li', 1, '<span class="icon"></span> <span class="a11y">', '</span>'),
));
?>
I can't add a new menu item (like my 'Move' attempt above), get [unknown link type] displayed on my site and I can't touch /inc/Menu/PageMenu.php
in any way (add items, change names etc.) as the whole site breaks. What am I overlooking here? Is there a list of menu items somewhere else in dokuwiki that's being cross checked?