Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
6 / 6 |
Hooks | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
6 / 6 |
onScribuntoExternalLibraries | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
registerScribuntoExternalLibraryPaths | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
<?php | |
namespace ArticlePlaceholder; | |
use ArticlePlaceholder\Lua\Scribunto_LuaArticlePlaceholderLibrary; | |
/** | |
* File defining the hook handlers for the ArticlePlaceholder extension. | |
* | |
* @license GPL-2.0-or-later | |
* @author Lucie-Aimée Kaffee | |
*/ | |
class Hooks { | |
/** | |
* External Lua libraries for Scribunto | |
* | |
* @param string $engine | |
* @param array[] &$extraLibraries | |
*/ | |
public static function onScribuntoExternalLibraries( $engine, array &$extraLibraries ) { | |
if ( $engine === 'lua' ) { | |
$extraLibraries['mw.ext.articlePlaceholder.entityRenderer'] = [ | |
'class' => Scribunto_LuaArticlePlaceholderLibrary::class, | |
'deferLoad' => true, | |
]; | |
} | |
} | |
/** | |
* External Lua library paths for Scribunto | |
* | |
* @param string $engine | |
* @param string[] &$extraLibraryPaths | |
*/ | |
public static function registerScribuntoExternalLibraryPaths( | |
$engine, | |
array &$extraLibraryPaths | |
) { | |
if ( $engine === 'lua' ) { | |
$extraLibraryPaths[] = __DIR__ . '/Lua'; | |
} | |
} | |
} |