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 <categorytree> tag.

Bug: T289997
Change-Id: I706c0ca89d84e3583eeee27a411f734c6969a8b7
This commit is contained in:
Fomafix 2021-08-30 14:16:42 +00:00 committed by Krinkle
parent 76f386c901
commit 5e61b40ee0
2 changed files with 9 additions and 5 deletions

View file

@ -128,7 +128,11 @@ class CategoryTreePage extends SpecialPage {
$output->addHTML( Xml::closeElement( 'div' ) ); $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( $this->tree->renderNode( $title, 1 ) );
$output->addHTML( Xml::closeElement( 'div' ) ); $output->addHTML( Xml::closeElement( 'div' ) );
} else { } else {

View file

@ -161,15 +161,15 @@
font-style: italic; font-style: italic;
} }
.CategoryTreeResult {
margin-top: 1.5ex;
}
.CategoryTreeTag { .CategoryTreeTag {
margin-top: 0.5ex; margin-top: 0.5ex;
margin-bottom: 0.5ex; margin-bottom: 0.5ex;
} }
.CategoryTreeResult {
margin-top: 1.5ex;
}
.CategoryTreeNotice { .CategoryTreeNotice {
font-style: italic; font-style: italic;
} }