From 7f4c29eff9ebf8a0997e8b31a5b45d69c615d2a5 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 6 Aug 2020 23:29:23 +0200 Subject: [PATCH] Add MDCurrenciesSet for controlling currencies --- l18n | 2 +- src/MDCurrenciesSet.php | 39 +++++++++++++++++++++++++++++++++++++++ src/MDValueSet.php | 3 ++- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/MDCurrenciesSet.php diff --git a/l18n b/l18n index 4b2c9ff..38c989b 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit 4b2c9ffee40ae15164b282177faabde441271821 +Subproject commit 38c989b971471a0b69fe486cedf1d35587640ce8 diff --git a/src/MDCurrenciesSet.php b/src/MDCurrenciesSet.php new file mode 100644 index 0000000..cf5f2fb --- /dev/null +++ b/src/MDCurrenciesSet.php @@ -0,0 +1,39 @@ + + */ + +/** + * Class containing available currencies. + */ +class MDCurrenciesSet extends MDValueSet { + + const CURRENCIES = [ + '', + "de-DM", + "de-RM", + "es-Real", + "eu-EUR", + "id-IDR", + "hu-Ft", + 'hu-Lari', + 'hu-Pengő', + "pl-Złoty", + "us-USD", + ]; + + /** + * Gets a list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getSortedList(MDTlLoader $tlLoader):array { + return parent::getTlSortedList($tlLoader, self::CURRENCIES, "currencies_set", "currencies_set"); + + } + +} diff --git a/src/MDValueSet.php b/src/MDValueSet.php index 5a0008e..f1c50c7 100644 --- a/src/MDValueSet.php +++ b/src/MDValueSet.php @@ -24,7 +24,8 @@ class MDValueSet { $output = []; foreach ($keyList as $tID) { - $output[$tID] = $tlLoader->tl($tlFileName, $tlVarName, $tID); + if ($tID === "") $output[$tID] = ""; + else $output[$tID] = $tlLoader->tl($tlFileName, $tlVarName, $tID); } asort($output);