summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
committerYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
commitfc7369835258467bf97eb64f184b93691f9a9fd5 (patch)
treedaabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/extensions/SemanticFormsSelect/SemanticFormsSelect.hooks.php
first commit
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;
+ }
+ }
+}