DAT-3622 always pass array to custom frame on api call

This commit is contained in:
idradm 2016-02-04 16:52:51 +01:00
parent 6a40c864e6
commit b9af596dbc

View file

@ -11,7 +11,7 @@ class ApiPortableInfobox extends ApiBase {
$title = $this->getParameter( "title" );
$arguments = $this->getFrameArguments();
if ( $arguments === null ) {
$this->getResult()->setWarning( "Arguments json format incorect or empty" );
$this->getResult()->setWarning( "Args param format is incorrect" );
}
/*
@ -48,12 +48,12 @@ class ApiPortableInfobox extends ApiBase {
$wgParser->startExternalParse( Title::newFromText( $title ), ParserOptions::newFromContext( $this->getContext() ), Parser::OT_HTML, true );
if ( is_array( $arguments ) ) {
foreach( $arguments as $key => &$value ) {
$value = $wgParser->replaceVariables( $value );
foreach ( $arguments as $key => &$value ) {
$value = $wgParser->replaceVariables( $value );
}
}
$frame = $wgParser->getPreprocessor()->newCustomFrame( $arguments );
$frame = $wgParser->getPreprocessor()->newCustomFrame( is_array( $arguments ) ? $arguments : [ ] );
try {
$output = PortableInfoboxParserTagController::getInstance()->render( $text, $wgParser, $frame );