-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
SemanticFormsSelect.hooks.php
54 lines (48 loc) · 1.44 KB
/
SemanticFormsSelect.hooks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace SFS;
/**
* @license GNU GPL v2+
* @since 3.0
* @author: Alexander Gesinn
*/
class Hooks {
/**
* Register Page Forms Input Type
*
* This is attached to the MediaWiki 'ParserFirstCallInit' hook.
*
* @param $parser Parser
* @return bool
*/
public static function onSemanticFormsSelectSetup ( & $parser ) {
if ( !defined( 'PF_VERSION' ) ) {
die( '<b>Error:</b><a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">Semantic Forms Select</a> requires the <a href="https://www.mediawiki.org/wiki/Extension:PageForms">Page Forms</a> extension. Please install and activate this extension first.' );
}
if ( isset( $GLOBALS['wgPageFormsFormPrinter'] ) ) {
$GLOBALS['wgPageFormsFormPrinter']->registerInputType( \SFS\SemanticFormsSelectInput::class );
}
return true;
}
public static function onRegistration() {
if ( isset( $GLOBALS['wgAPIModules'] ) ) {
$GLOBALS['wgAPIModules']['sformsselect'] = \SFS\ApiSemanticFormsSelect::class;
}
}
/**
* Hook: ResourceLoaderTestModules
* @param array &$modules
*/
public static function onResourceLoaderTestModules( array &$modules ) {
$modules['qunit']['ext.sfs.unit'] = [
'scripts' => [
'res/sfs.js',
'tests/qunit/unit/sfs.test.js'
],
'dependencies' => [
'ext.pageforms.originalValueLookup'
],
'localBasePath' => __DIR__,
'remoteExtPath' => 'SemanticFormsSelect',
];
}
}