From 04af95e6f3ee462355c0d2a1ac8ccac9ef0ef432 Mon Sep 17 00:00:00 2001 From: vv221 Date: Tue, 28 Apr 2020 13:26:30 +0200 Subject: [PATCH] A link to the current page can be shown This is configurable through the administration panel. Default is to not include a link to the current page. --- action.php | 6 ++++-- conf/default.php | 1 + conf/metadata.php | 1 + lang/en/lang.php | 2 +- lang/en/settings.php | 1 + lang/fr/lang.php | 2 +- lang/fr/settings.php | 1 + 7 files changed, 10 insertions(+), 4 deletions(-) diff --git a/action.php b/action.php index a97fc81..dccc97c 100644 --- a/action.php +++ b/action.php @@ -40,17 +40,19 @@ class action_plugin_childrenpages extends DokuWiki_Action_Plugin { if ( $event->data['view'] !== 'page' ) { return; } + // Check if all links should be shown, or if the one to the current page shoud be excluded + $show_all_links = (bool) $this->getConf('show_link_to_current_page'); // If the current page is included in a reserved namespace, add a link back to main page $children_types = $this->getConf('children_list'); $top_namespace = $this->getTopLevelNamespace(); $is_child_page = in_array($top_namespace, $children_types); - if ( $is_child_page ) { + if ( $show_all_links || $is_child_page ) { $main_label = $this->getLang('btn_main'); $this->addMenuItem($event, '_main', $main_label, $top_namespace); } // Add menu items for each child page foreach ( $children_types as $child_type ) { - if ( $child_type !== $top_namespace ) { + if ( $show_all_links || $child_type !== $top_namespace ) { $child_label = $this->getLang("btn_$child_type"); $this->addMenuItem($event, $child_type, $child_label, $is_child_page); } diff --git a/conf/default.php b/conf/default.php index 611cbb3..94c2d59 100644 --- a/conf/default.php +++ b/conf/default.php @@ -1,3 +1,4 @@