Mollywhite has uploaded a new change for review.
https://gerrit.wikimedia.org/r/76644
Change subject: Bug 52052: Add namespace configuration variable for navbar
......................................................................
Bug 52052: Add namespace configuration variable for navbar
By default, the navigation bars will be added to pages that are
in $wgContentNamespaces, but this allows the wiki admin to set
the namespaces in which the navbars should appear.
Bug: 52052
Change-Id: Ied6a1b9e644b9cf8d5109e7bf385ce8576abc634
---
M BookManagerv2.hooks.php
M BookManagerv2.php
2 files changed, 20 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BookManagerv2
refs/changes/44/76644/1
diff --git a/BookManagerv2.hooks.php b/BookManagerv2.hooks.php
index ec38eff..55017f0 100644
--- a/BookManagerv2.hooks.php
+++ b/BookManagerv2.hooks.php
@@ -332,9 +332,18 @@
* block.
*/
public static function onBeforePageDisplay( OutputPage &$out, Skin
&$skin ) {
- // Check that the navigation bar is only added to mainspace
pages.
- global $wgContentNamespaces;
- if ( in_array( $out->getTitle()->getNamespace(),
$wgContentNamespaces ) ) {
+ global $wgContentNamespaces,
$wgBookManagerv2NavigationNamespaces;
+
+ // Navbars will be added to namespaces in the
+ // $wgBookManagerv2NavigationNamespaces array if it's set,
otherwise
+ // the $wgContentNamespaces
+ if ( is_array( $wgBookManagerv2NavigationNamespaces ) ) {
+ $navigationNamespaces =
$wgBookManagerv2NavigationNamespaces;
+ } else {
+ $navigationNamespaces = $wgContentNamespaces;
+ }
+
+ if ( in_array( $out->getTitle()->getNamespace(),
$navigationNamespaces ) ) {
if ( $out->getRevisionId() !== null ) {
global $wgContLang,
$wgBookManagerv2ExampleNavigation, $wgMemc;
$categories = $out->getCategories();
diff --git a/BookManagerv2.php b/BookManagerv2.php
index 67fa8a4..1fc728c 100644
--- a/BookManagerv2.php
+++ b/BookManagerv2.php
@@ -154,3 +154,11 @@
* page, drawing the information from examples/book.json
*/
$wgBookManagerv2ExampleNavigation = false;
+
+/**
+ * @var array|null
+ * If null, the navigation bars are added to the $wgContentNamespaces
+ * namespaces. Otherwise, the navigation bars are added to the
+ * namespaces in this array.
+ */
+$wgBookManagerv2NavigationNamespaces = null;
--
To view, visit https://gerrit.wikimedia.org/r/76644
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied6a1b9e644b9cf8d5109e7bf385ce8576abc634
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BookManagerv2
Gerrit-Branch: master
Gerrit-Owner: Mollywhite <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits