mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Merge "Remove $allowMissing and make the check directly on the hook"
This commit is contained in:
commit
ee0a3f1aab
|
@ -78,11 +78,10 @@ class CategoryTree {
|
|||
* @param bool $hideroot
|
||||
* @param array $attr
|
||||
* @param int $depth
|
||||
* @param bool $allowMissing
|
||||
* @return bool|string
|
||||
*/
|
||||
public function getTag( ?Parser $parser, string $category, bool $hideroot = false, array $attr = [],
|
||||
int $depth = 1, bool $allowMissing = false
|
||||
int $depth = 1
|
||||
) {
|
||||
$disableCache = $this->config->get( 'CategoryTreeDisableCache' );
|
||||
|
||||
|
@ -114,7 +113,7 @@ class CategoryTree {
|
|||
$attr['data-ct-mode'] = $this->optionManager->getOption( 'mode' );
|
||||
$attr['data-ct-options'] = $this->optionManager->getOptionsAsJsStructure();
|
||||
|
||||
if ( !$allowMissing && !$title->getArticleID() ) {
|
||||
if ( !$title->getArticleID() ) {
|
||||
$html = Html::rawElement( 'span', [ 'class' => 'CategoryTreeNotice' ],
|
||||
wfMessage( 'categorytree-not-found' )
|
||||
->plaintextParams( $category )
|
||||
|
|
|
@ -185,15 +185,13 @@ class Hooks implements
|
|||
* @param array $argv
|
||||
* @param Parser|null $parser
|
||||
* @param PPFrame|null $frame
|
||||
* @param bool $allowMissing
|
||||
* @return bool|string
|
||||
*/
|
||||
public function parserHook(
|
||||
$cat,
|
||||
array $argv,
|
||||
Parser $parser = null,
|
||||
PPFrame $frame = null,
|
||||
$allowMissing = false
|
||||
PPFrame $frame = null
|
||||
) {
|
||||
if ( $parser ) {
|
||||
$parserOutput = $parser->getOutput();
|
||||
|
@ -226,7 +224,7 @@ class Hooks implements
|
|||
}
|
||||
|
||||
return $message .
|
||||
$ct->getTag( $parser, $cat, $hideroot, $attr, $depth, $allowMissing );
|
||||
$ct->getTag( $parser, $cat, $hideroot, $attr, $depth );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,13 +245,17 @@ class Hooks implements
|
|||
// Not enabled, don't do anything
|
||||
return;
|
||||
}
|
||||
if ( !$categoryTitle->exists() ) {
|
||||
// Category doesn't exist. Let the normal LinkRenderer generate the link.
|
||||
return;
|
||||
}
|
||||
|
||||
CategoryTree::setHeaders( $out );
|
||||
|
||||
$options = $this->config->get( 'CategoryTreePageCategoryOptions' );
|
||||
$link = $this->parserHook(
|
||||
$this->titleFormatter->getPrefixedText( $categoryTitle ),
|
||||
$options, null, null, true
|
||||
$options
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue