mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-15 03:23:51 +00:00
Merge "Override ContentHandler::fillParserOutput instead of Content::fillParserOutput."
This commit is contained in:
commit
669b351241
|
@ -43,30 +43,6 @@ class GadgetDefinitionContent extends JsonContent {
|
|||
return FormatJson::encode( $this->getAssocArray(), "\t", FormatJson::UTF8_OK );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register some links
|
||||
*
|
||||
* @param Title $title
|
||||
* @param int $revId
|
||||
* @param ParserOptions $options
|
||||
* @param bool $generateHtml
|
||||
* @param ParserOutput &$output
|
||||
*/
|
||||
protected function fillParserOutput( Title $title, $revId,
|
||||
ParserOptions $options, $generateHtml, ParserOutput &$output
|
||||
) {
|
||||
parent::fillParserOutput( $title, $revId, $options, $generateHtml, $output );
|
||||
$assoc = $this->getAssocArray();
|
||||
foreach ( [ 'scripts', 'styles' ] as $type ) {
|
||||
foreach ( $assoc['module'][$type] as $page ) {
|
||||
$title = Title::makeTitleSafe( NS_GADGET, $page );
|
||||
if ( $title ) {
|
||||
$output->addLink( $title );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Status
|
||||
*/
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\Content\Renderer\ContentParseParams;
|
||||
use MediaWiki\Revision\SlotRenderingProvider;
|
||||
|
||||
class GadgetDefinitionContentHandler extends JsonContentHandler {
|
||||
|
@ -101,4 +102,25 @@ class GadgetDefinitionContentHandler extends JsonContentHandler {
|
|||
[ new GadgetDefinitionSecondaryDataUpdate( $title ) ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function fillParserOutput(
|
||||
Content $content,
|
||||
ContentParseParams $cpoParams,
|
||||
ParserOutput &$output
|
||||
) {
|
||||
'@phan-var GadgetDefinitionContent $content';
|
||||
parent::fillParserOutput( $content, $cpoParams, $output );
|
||||
$assoc = $content->getAssocArray();
|
||||
foreach ( [ 'scripts', 'styles' ] as $type ) {
|
||||
foreach ( $assoc['module'][$type] as $page ) {
|
||||
$title = Title::makeTitleSafe( NS_GADGET, $page );
|
||||
if ( $title ) {
|
||||
$output->addLink( $title );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue