Add children pages to all pages that are not included in a reserved namespace

This commit is contained in:
vv221 2020-04-03 02:19:57 +02:00
parent 71295a3ec3
commit a45accac4b

View file

@ -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);