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.
This commit is contained in:
parent
9e5c7a32e3
commit
04af95e6f3
7 changed files with 10 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
|
||||
$conf['children_list'] = array('animation', 'gameplay', 'dev', 'talk');
|
||||
$conf['show_link_to_current_page'] = 0;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
|
||||
$meta['children_list'] = [ 'array' ];
|
||||
$meta['show_link_to_current_page'] = [ 'onoff' ];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$lang['btn_main'] = 'Back to main page';
|
||||
$lang['btn_main'] = 'Main article';
|
||||
|
||||
$lang['btn_animation'] = 'Animation';
|
||||
$lang['btn_dev'] = 'Dev';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
|
||||
$lang['children_list'] = 'List of namespaces reserved for children pages';
|
||||
$lang['show_link_to_current_page'] = 'Include a link to the page currently shown';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$lang['btn_main'] = 'Retour à la page principale';
|
||||
$lang['btn_main'] = 'Article principal';
|
||||
|
||||
$lang['btn_animation'] = 'Animation';
|
||||
$lang['btn_dev'] = 'Dev';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
|
||||
$lang['children_list'] = 'Liste des espaces de nom réservés aux pages enfants';
|
||||
$lang['show_link_to_current_page'] = 'Inclure un lien vers la page actuellement affichée';
|
||||
|
|
Loading…
Reference in a new issue