Only take action if the current page is not included in a namespace

This is to avoid recursive children pages creation, a future update will
handle this in a smarter way.
This commit is contained in:
vv221 2020-04-03 00:56:58 +02:00
parent ec2433d044
commit a1c1c23c45

View file

@ -27,6 +27,7 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin {
* @param Doku_Event $event * @param Doku_Event $event
*/ */
public function addMenuItem(Doku_Event $event) : void { public function addMenuItem(Doku_Event $event) : void {
global $INFO;
// Check that this method has been called in the expected context // Check that this method has been called in the expected context
if ( $event->name !== 'MENU_ITEMS_ASSEMBLY' ) { if ( $event->name !== 'MENU_ITEMS_ASSEMBLY' ) {
$message = "Tabpage plugin error:"; $message = "Tabpage plugin error:";
@ -38,6 +39,10 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin {
if ( $event->data['view'] !== 'page' ) { if ( $event->data['view'] !== 'page' ) {
return; return;
} }
// Only add links if the current page is not included in a namespace
if ( ! empty($INFO['namespace']) ) {
return;
}
trigger_error('addMenuItem() not implemented in '.get_class($this), E_USER_WARNING); trigger_error('addMenuItem() not implemented in '.get_class($this), E_USER_WARNING);
} }
} }