On Fri, Jun 22, 2012 at 12:19 PM, Daniel Werner
<daniel.wer...@wikimedia.de> wrote:
> I was wondering whether it is possible somehow to register a javascript var
> for a certain resource loader module in php?
This is a feature I've been wanting to have in ResourceLoader for a
while, but I haven't gotten around to implementing it yet.

> There is the
> OuputPage::addJsConfigVars function but I didn't find anything to only load
> a var only conditionally when a module is loaded. Right now I am
> registering a variable in the  ResourceLoaderGetConfigVars  hook, but
> actually, I only want to have it included when the 'wikibase' module is
> loaded since it is rather big and shouldn't be loaded when not necessary.
>
A workaround you can use is to write your own custom module (a
subclass of ResourceLoaderModule) that provides this variable. I did
this in VisualEditor recently, see
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/VisualEditor.git;a=commitdiff;h=ae48f152f92753a438fb9b371e2f70cd40ff179c
.

Roan

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to