From 5e61b40ee0c142fc9b7c041710da36f40f247010 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Mon, 30 Aug 2021 14:16:42 +0000 Subject: [PATCH] Restore support for modes for subcategories in Special:CategoryTree This feature was lost in c839756b. Before c839756b on Special:CategoryTree the mode was transfered via the individual global JavaScript variable wgCategoryTreePageCategoryOptions. c839756b removed the possibility to set the global JavaScript variable to a page individual value. Now Special:CategoryTree uses the HTML attribute to transfer the individual options to JavaScript like at a tag. Bug: T289997 Change-Id: I706c0ca89d84e3583eeee27a411f734c6969a8b7 --- includes/CategoryTreePage.php | 6 +++++- modules/ext.categoryTree.styles.css | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/includes/CategoryTreePage.php b/includes/CategoryTreePage.php index ac98b63b..b05c55b1 100644 --- a/includes/CategoryTreePage.php +++ b/includes/CategoryTreePage.php @@ -128,7 +128,11 @@ class CategoryTreePage extends SpecialPage { $output->addHTML( Xml::closeElement( 'div' ) ); - $output->addHTML( Xml::openElement( 'div', [ 'class' => 'CategoryTreeResult' ] ) ); + $output->addHTML( Xml::openElement( 'div', [ + 'class' => 'CategoryTreeResult CategoryTreeTag', + 'data-ct-mode' => $this->tree->getOption( 'mode' ), + 'data-ct-options' => $this->tree->getOptionsAsJsStructure(), + ] ) ); $output->addHTML( $this->tree->renderNode( $title, 1 ) ); $output->addHTML( Xml::closeElement( 'div' ) ); } else { diff --git a/modules/ext.categoryTree.styles.css b/modules/ext.categoryTree.styles.css index 43c9d2ac..e4d66862 100644 --- a/modules/ext.categoryTree.styles.css +++ b/modules/ext.categoryTree.styles.css @@ -161,15 +161,15 @@ font-style: italic; } -.CategoryTreeResult { - margin-top: 1.5ex; -} - .CategoryTreeTag { margin-top: 0.5ex; margin-bottom: 0.5ex; } +.CategoryTreeResult { + margin-top: 1.5ex; +} + .CategoryTreeNotice { font-style: italic; }