summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php')
-rw-r--r--www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php b/www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php
new file mode 100644
index 00000000..7138c0c4
--- /dev/null
+++ b/www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php
@@ -0,0 +1,38 @@
+<?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;
+ }
+ }
+}