So just to get things straight, i'm rather new with mediawiki development.
I have created an extension where i hook into the tag <sidebarmenu>, and so when this tag is present in the wiki the following method is called:
public static function renderFromTag( $input, array $args, Parser $parser, PPFrame $frame )
Now my issue is that i want to publish some $args with certain keys to the output as javascript variables so they are available in mw.config.get('my-key'). I have tried using $wgOut->addJsConfigVars(..), but this doesn't seem to do anything.
i also have the following hook
$wgHooks['ResourceLoaderGetConfigVars'][] = 'SideBarMenuHooks::javascriptConfigVars';
which calls this method.
public static function javascriptConfigVars(&$vars).
And this works fine, all variables i add to the $vars is present in mw.config.get()...
so how can i pass my <sidebarmenu> tag parameters to mw.config?
Any help is appreciated. Best regards. Kim
Nevermind, i solved it by outputting raw <script></script> above my extension output with my configuration needs. and then i removed my javascript hook "ResourceLoaderGetConfigVars".
On Wed, Mar 7, 2012 at 12:09 PM, Kim Eik kim@heldig.org wrote:
So just to get things straight, i'm rather new with mediawiki development.
I have created an extension where i hook into the tag <sidebarmenu>, and so when this tag is present in the wiki the following method is called:
public static function renderFromTag( $input, array $args, Parser $parser, PPFrame $frame )
Now my issue is that i want to publish some $args with certain keys to the output as javascript variables so they are available in mw.config.get('my-key'). I have tried using $wgOut->addJsConfigVars(..), but this doesn't seem to do anything.
i also have the following hook
$wgHooks['ResourceLoaderGetConfigVars'][] = 'SideBarMenuHooks::javascriptConfigVars';
which calls this method.
public static function javascriptConfigVars(&$vars).
And this works fine, all variables i add to the $vars is present in mw.config.get()...
so how can i pass my <sidebarmenu> tag parameters to mw.config?
Any help is appreciated. Best regards. Kim
wikitech-l@lists.wikimedia.org