mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-13 17:57:11 +00:00
Merge "Only enable OOUI if it will be used"
This commit is contained in:
commit
f12ac68e50
|
@ -127,18 +127,18 @@ class TemplateDataHooks {
|
||||||
* @return string: HTML to insert in the page.
|
* @return string: HTML to insert in the page.
|
||||||
*/
|
*/
|
||||||
public static function render( $input, $args, $parser, $frame ) {
|
public static function render( $input, $args, $parser, $frame ) {
|
||||||
$parser->enableOOUI();
|
|
||||||
$ti = TemplateDataBlob::newFromJSON( $input );
|
$ti = TemplateDataBlob::newFromJSON( $input );
|
||||||
|
|
||||||
$status = $ti->getStatus();
|
$status = $ti->getStatus();
|
||||||
if ( !$status->isOK() ) {
|
if ( !$status->isOK() ) {
|
||||||
$parser->getOutput()->ext_templatedata_status = $status;
|
$parser->getOutput()->ext_templatedata_status = $status;
|
||||||
return '<div class="errorbox">' . $status->getHtml() . '</div>';
|
return '<div class="errorbox">' . $status->getHTML() . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$parser->getOutput()->setProperty( 'templatedata', $ti->getJSONForDatabase() );
|
$parser->getOutput()->setProperty( 'templatedata', $ti->getJSONForDatabase() );
|
||||||
|
|
||||||
$parser->getOutput()->addModuleStyles( 'ext.templateData' );
|
$parser->getOutput()->addModuleStyles( 'ext.templateData' );
|
||||||
|
$parser->enableOOUI();
|
||||||
|
|
||||||
return $ti->getHtml( $parser->getOptions()->getUserLangObj() );
|
return $ti->getHtml( $parser->getOptions()->getUserLangObj() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue