aboutsummaryrefslogtreecommitdiff
path: root/model/Conferences.php
diff options
context:
space:
mode:
authorBenjamin Peter2017-12-12 14:07:49 +0100
committerGitHub2017-12-12 14:07:49 +0100
commit3229c9e8af148575d87b4dfbd878ffb300a2ddd2 (patch)
tree52a824f118f99f14d7079d2c05e9f3035350e1ee /model/Conferences.php
parent65397e5734b1439df4d68be40ffe994f26e551ec (diff)
parent0b73843d5e0d0ac22a46db28090e707566668ae4 (diff)
Merge pull request #56 from voc/feature/multitranslations
Feature/multitranslations
Diffstat (limited to '')
-rw-r--r--model/Conferences.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/model/Conferences.php b/model/Conferences.php
index f7276ac..575759e 100644
--- a/model/Conferences.php
+++ b/model/Conferences.php
@@ -72,6 +72,33 @@ class Conferences
return in_array($mandator, Conferences::listConferences());
}
+ private static function migrateTranslationConfiguration($config) {
+ // Allow setting TRANSLATION simply to true and fill in default values for uniformity
+ $rooms = $config['ROOMS'];
+ foreach ($rooms as $slug => $room) {
+ // Translation is commented out, equaivalent of false
+ if (!isset($room['TRANSLATION'])) {
+ $config['ROOMS'][$slug]['TRANSLATION'] = [];
+ }
+ // Translation is present but not an array
+ elseif (! is_array($room['TRANSLATION'])) {
+ // Translation is true, set default values
+ if ($room['TRANSLATION'] === true) {
+ $config['ROOMS'][$slug]['TRANSLATION'] = [[
+ 'endpoint' => 'translated',
+ 'label' => 'Translated'
+ ]];
+ }
+ // Translation is false or garbage
+ else {
+ $config['ROOMS'][$slug]['TRANSLATION'] = [];
+ }
+ }
+ }
+
+ return $config;
+ }
+
public static function loadConferenceConfig($mandator) {
$configfile = forceslash(Conferences::MANDATOR_DIR).forceslash($mandator).'config.php';
$config = include($configfile);
@@ -80,6 +107,8 @@ class Conferences
throw new ConfigException("Loading $configfile did not return an array. Maybe it's missing a return-statement?");
}
+ $config = Conferences::migrateTranslationConfiguration($config);
+
return $config;
}