Where to call addModules()?

旧巷老猫 提交于 2019-12-11 03:02:36

问题


I would like to add some scripts and styles to all my wiki pages. So I have create the file /extensions/MyExtension/MyExtension.php and I put a following array like this:

$wgResourceModules['ext.MyExtension.foo'] = array(
    'scripts' => 'modules/ext.MyExtension.foo.js',
    'styles' => array('modules/ext.MyExtension.foo.css','modules/ext.MyExtension.bar.css'),
    'localBasePath' => __DIR__,
    'remoteExtPath' => 'MyExtension',
);

But in the documentation they say that I have to call

 $this->getOutput()->addModules( 'ext.myExtension' );

but I don't know where I have to call it.


回答1:


Typically you would implement the BeforePageDisplay hook and use the OutputPage object received there.



来源:https://stackoverflow.com/questions/31626025/where-to-call-addmodules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!