mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Merge "Get mode from data-ct-options instead of data-ct-mode"
This commit is contained in:
commit
6f4d131768
|
@ -92,7 +92,6 @@ class CategoryTree {
|
|||
$attr['class'] = 'CategoryTreeTag';
|
||||
}
|
||||
|
||||
$attr['data-ct-mode'] = $this->optionManager->getOption( 'mode' );
|
||||
$attr['data-ct-options'] = $this->optionManager->getOptionsAsJsStructure();
|
||||
|
||||
if ( !$title->getArticleID() ) {
|
||||
|
|
|
@ -193,7 +193,6 @@ class CategoryTreePage extends SpecialPage {
|
|||
$output->addHTML( Html::rawElement( 'div',
|
||||
[
|
||||
'class' => 'CategoryTreeResult CategoryTreeTag',
|
||||
'data-ct-mode' => $this->tree->optionManager->getOption( 'mode' ),
|
||||
'data-ct-options' => $this->tree->optionManager->getOptionsAsJsStructure(),
|
||||
],
|
||||
$this->tree->renderNode( $title, 1 )
|
||||
|
|
|
@ -143,9 +143,8 @@ function loadChildren( $link, $children ) {
|
|||
// Element may not have a .CategoryTreeTag parent, fallback to defauls
|
||||
// Probably a CategoryPage (@todo: based on what?)
|
||||
const ctTitle = $link.attr( 'data-ct-title' );
|
||||
const ctMode = $linkParentCTTag.data( 'ct-mode' );
|
||||
const mode = typeof ctMode === 'number' ? ctMode : undefined;
|
||||
const ctOptions = $linkParentCTTag.attr( 'data-ct-options' ) || config.defaultCtOptions;
|
||||
const mode = JSON.parse( ctOptions ).mode;
|
||||
|
||||
// Mode and options have defaults or fallbacks, title does not.
|
||||
// Don't make a request if there is no title.
|
||||
|
|
Loading…
Reference in a new issue