Add mvconfig tag
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -34,6 +34,28 @@ class GlModelHooks {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MWHook: Called when the parser initializes for the first time
|
||||
*
|
||||
* @param Parser $parser: Parser object being initialized
|
||||
*/
|
||||
static function onParserFirstCallInit( $parser ) {
|
||||
$parser->setHook('mvconfig', array( __CLASS__, 'renderConfigTag'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the config json in a <pre> tag
|
||||
*
|
||||
* @param $input The text inside the custom tag
|
||||
* @param array $args Any attributes given in the tag
|
||||
* @param Parser $parser The parser object
|
||||
* @param PPFrame $frame The parent frame calling the parser
|
||||
* @return string HTML string of output
|
||||
*/
|
||||
static function renderConfigTag( $input, array $args, $parser, $frame ) {
|
||||
return '<pre mvconfig>' . $input . '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
* MWHook: Load the js and css modules if model-viewer element is found in the html output
|
||||
*
|
||||
@@ -110,7 +132,7 @@ class GlModelHooks {
|
||||
public static function onUploadFormBeforeProcessing( $uploadFormObj ) {
|
||||
$uploadFormObj->mComment .= <<<CONF
|
||||
|
||||
<pre>
|
||||
<mvconfig>
|
||||
{
|
||||
"viewerConfig": {
|
||||
"default": {
|
||||
@@ -120,7 +142,7 @@ class GlModelHooks {
|
||||
"annotations": {},
|
||||
"annotationSets": {}
|
||||
}
|
||||
</pre>
|
||||
</mvconfig>
|
||||
CONF;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user