From d4557c8cbd2970a2dbdabd0a3b6d90ea86ae7a30 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 6 Aug 2020 17:57:38 +0200 Subject: [PATCH] Add static function for getting a sorted, translated list of event types --- l18n | 2 +- src/MDEventsSet.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/l18n b/l18n index d62d3eb..8d4634f 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit d62d3eb5b774740b6ceeec45a13eccf6be5fae60 +Subproject commit 8d4634f65fe004899fd054001cc1d10d62d5c0d6 diff --git a/src/MDEventsSet.php b/src/MDEventsSet.php index c515e40..2065999 100644 --- a/src/MDEventsSet.php +++ b/src/MDEventsSet.php @@ -49,4 +49,23 @@ class MDEventsSet { '38', // => Illustrated ]; + /** + * Gets a list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getSortedList(MDTlLoader $tlLoader):array { + + $output = []; + foreach (self::EVENT_IDS as $tID) { + $output[$tID] = $tlLoader->tl("eventtype_name", "eventname", $tID); + } + + asort($eventTypes); + return $output; + + } + }