21 public function __construct( $modelId = MessageBundleContent::CONTENT_MODEL_ID ) {
22 parent::__construct( $modelId, [ CONTENT_FORMAT_JSON ] );
25 protected function getContentClass():
string {
26 return MessageBundleContent::class;
29 public function makeEmptyContent(): Content {
30 $class = $this->getContentClass();
31 return new $class(
'{}' );
34 public function validateSave( Content $content, ValidationParams $validationParams ) {
40 return StatusValue::newGood();
43 return StatusValue::newFatal(
'translate-messagebundle-validation-error', wfMessage( $e ) );
56 ContentParseParams $cpoParams,
57 ParserOutput &$parserOutput
60 throw new InvalidArgumentException(
61 'Expected $content to be MessageBundleContent; got: ' . get_class( $content )
65 if ( $cpoParams->getGenerateHtml() && $content->isValid() ) {
66 $parserOutput->setText( $content->rootValueTable( $content->getData()->getValue() ) );
67 $parserOutput->addModuleStyles( [
'mediawiki.content.json' ] );
69 $parserOutput->setText(
null );