addResources( 'ext.smw.style' );
return Html::rawElement(
'div',
[ 'class' => 'smw-spinner left mw-small-spinner' ],
Html::element(
'p',
[ 'class' => 'text' ],
$this->msg( 'smw-livepreview-loading' )->inContentLanguage()->text()
)
);
}
/**
* @deprecated since 2.0
*/
protected function loading() {
return $this->createLoadingHtmlPlaceholder();
}
/**
* Convenience method to encode output data
*
* @since 1.9
*
* @param string $id
* @param array $data
*/
protected function encodeToJsonForId( $id, $data ) {
SMWOutputs::requireHeadItem(
$id,
$this->getSkin()->makeVariablesScript( [ $id => FormatJson::encode( $data ) ]
) );
return $this;
}
/**
* @deprecated since 2.0
*/
protected function encode( $id, $data ) {
return $this->encodeToJsonForId( $id, $data );
}
/**
* Returns serialised content
*
* @see SMWResultPrinter::getResultText()
*
* @param SMWQueryResult $queryResult
* @param $outputMode
*
* @return string
*/
protected function getResultText( SMWQueryResult $queryResult, $outputMode ) {
// Add parameters that are only known to the specific printer
$ask = $queryResult->getQuery()->toArray();
foreach ( $this->params as $key => $value ) {
if ( is_string( $value ) || is_integer( $value ) || is_bool( $value ) ) {
$ask['parameters'][$key] = $value;
}
}
// Combine all data into one object
$data = [
'query' => [
'result' => $queryResult->toArray(),
'ask' => $ask
]
];
return $this->getHtml( $data );
}
}