summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/MetaYamlSchemaExtender.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/Translate/MetaYamlSchemaExtender.php
first commit
Diffstat (limited to 'www/wiki/extensions/Translate/MetaYamlSchemaExtender.php')
-rw-r--r--www/wiki/extensions/Translate/MetaYamlSchemaExtender.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/www/wiki/extensions/Translate/MetaYamlSchemaExtender.php b/www/wiki/extensions/Translate/MetaYamlSchemaExtender.php
new file mode 100644
index 00000000..b1fc5cd5
--- /dev/null
+++ b/www/wiki/extensions/Translate/MetaYamlSchemaExtender.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * Message groups are usually configured in YAML, though the actual storage format does not matter,
+ * because they are parsed to PHP arrays anyway. The configuration consists of sections, and in some
+ * section there is key 'class' which defines the class implementing that part of behavior. These
+ * classes can take custom parameters, so in essense our configuration format is open-ended. To
+ * implement proper validation, those classes can extend the schema runtime by implementing this
+ * interface. Validation is implemented with the MetaYaml library.
+ *
+ * Because neither is_a nor instanceof accept class names, validation code will check directly
+ * whether this method exists, whether the class implements the interface or not.
+ *
+ * @see https://github.com/romaricdrigon/MetaYaml
+ * @see https://www.mediawiki.org/wiki/Help:Extension:Translate/Group_configuration
+ * @since 2014.01
+ */
+interface MetaYamlSchemaExtender {
+ /**
+ * Return a data structure that will be merged with the base schema. It is not possible to remove
+ * things.
+ * @return array
+ */
+ public static function getExtraSchema();
+}