From a45accac4b8740d4c1eea26d319bda04996dd1bd Mon Sep 17 00:00:00 2001 From: vv221 Date: Fri, 3 Apr 2020 02:19:57 +0200 Subject: [PATCH] Add children pages to all pages that are not included in a reserved namespace --- action.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/action.php b/action.php index e081f7f..69d5190 100644 --- a/action.php +++ b/action.php @@ -41,12 +41,14 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin { if ( $event->data['view'] !== 'page' ) { return; } - // Only add links if the current page is not included in a namespace - if ( ! empty($INFO['namespace']) ) { - return; - } // Get the list of children pages $children_types = $this->getConf('children_list'); + // Only add links if the current page is not included in a reserved namespace + $top_namespace = explode(':', $INFO['namespace'])[0]; + if ( in_array($top_namespace, $children_types) ) { + return; + } + // Add menu items for each child page foreach ( $children_types as $child_type ) { $child_label = $this->getLang("btn_$child_type"); $this->addMenuItem($event, $child_type, $child_label);