9use MediaWiki\Cache\LinkBatchFactory;
26 private LinkBatchFactory $linkBatchFactory;
30 LinkBatchFactory $linkBatchFactory,
33 parent::__construct(
'TrackingCategories' );
34 $this->linkBatchFactory = $linkBatchFactory;
35 $this->trackingCategories = $trackingCategories;
43 $this->
getOutput()->getMetadata()->setPreventClickjacking(
false );
45 'jquery.tablesorter.styles',
46 'mediawiki.pager.styles'
48 $this->
getOutput()->addModules(
'jquery.tablesorter' );
50 Html::openElement(
'table', [
'class' => [
'mw-datatable',
'sortable' ],
51 'id' =>
'mw-trackingcategories-table' ] ) .
"\n" .
59 $categoryList = $this->trackingCategories->getTrackingCategories();
61 $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
62 foreach ( $categoryList as $data ) {
63 $batch->addObj( $data[
'msg'] );
64 foreach ( $data[
'cats'] as $catTitle ) {
65 $batch->addObj( $catTitle );
70 $this->
getHookRunner()->onSpecialTrackingCategories__preprocess( $this, $categoryList );
74 foreach ( $categoryList as $catMsg => $data ) {
76 $catDesc = $catMsg .
'-desc';
78 $catMsgTitleText = $linkRenderer->makeLink(
83 foreach ( $data[
'cats'] as $catTitle ) {
85 $linkRenderer->makeLink(
90 $this->
getHookRunner()->onSpecialTrackingCategories__generateCatLink(
91 $this, $catTitle, $html );
96 # Extra message, when no category was found
97 if ( $allMsgs === [] ) {
98 $allMsgs[] = $this->
msg(
'trackingcategories-disabled' )->parse();
105 $descMsg = $this->
msg( $catDesc );
106 if ( $descMsg->isBlank() ) {
107 $descMsg = $this->
msg(
'trackingcategories-nodesc' );
111 Html::openElement(
'tr' ) .
112 Html::openElement(
'td', [
'class' =>
'mw-trackingcategories-name' ] ) .
113 $this->
getLanguage()->commaList( array_unique( $allMsgs ) ) .
114 Html::closeElement(
'td' ) .
115 Html::openElement(
'td', [
'class' =>
'mw-trackingcategories-msg' ] ) .
117 Html::closeElement(
'td' ) .
118 Html::openElement(
'td', [
'class' =>
'mw-trackingcategories-desc' ] ) .
120 Html::closeElement(
'td' ) .
121 Html::closeElement(
'tr' )
124 $this->
getOutput()->addHTML( Html::closeElement(
'table' ) );
137class_alias( SpecialTrackingCategories::class,
'SpecialTrackingCategories' );
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getContentLanguage()
Shortcut to get content language.
getLanguage()
Shortcut to get user's language.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages By default the message key is the canonical name of...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.