mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-15 03:43:55 +00:00
Simplify code by using Xml::element()
Change-Id: I8b0d1c35d8d7cc310769d586a1716ef5ffbd46b3
This commit is contained in:
parent
a02e1278c9
commit
0a3f30b8d7
|
@ -638,20 +638,19 @@ class CategoryTree {
|
|||
$linkattr[ 'class' ] = "CategoryTreeToggle";
|
||||
$linkattr['data-ct-title'] = $key;
|
||||
|
||||
$tag = 'span';
|
||||
if ( $children == 0 ) {
|
||||
// Use ->plain() and htmlspecialchars() to ensure
|
||||
// identical to what is done by JS, which does:
|
||||
// $link.text( mw.msg( 'categorytree-expand-bullet' ) )
|
||||
$txt = htmlspecialchars( wfMessage( 'categorytree-expand-bullet' )->plain() );
|
||||
// Use ->plain() to ensure identical result as JS,
|
||||
// which does:
|
||||
// $link.text( mw.msg( 'categorytree-expand-bullet' ) );
|
||||
$txt = wfMessage( 'categorytree-expand-bullet' )->plain();
|
||||
$linkattr[ 'data-ct-state' ] = 'collapsed';
|
||||
} else {
|
||||
$txt = htmlspecialchars( wfMessage( 'categorytree-collapse-bullet' )->plain() );
|
||||
$txt = wfMessage( 'categorytree-collapse-bullet' )->plain();
|
||||
$linkattr[ 'data-ct-loaded' ] = true;
|
||||
$linkattr[ 'data-ct-state' ] = 'expanded';
|
||||
}
|
||||
|
||||
$bullet = Xml::openElement( $tag, $linkattr ) . $txt . Xml::closeElement( $tag ) . ' ';
|
||||
$bullet = Html::element( 'span', $linkattr, $txt ) . ' ';
|
||||
}
|
||||
} else {
|
||||
$bullet = wfMessage( 'categorytree-page-bullet' )->escaped();
|
||||
|
|
Loading…
Reference in a new issue