From 401d557b668d13299724da5d531940b37ec14c59 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sat, 13 Mar 2021 01:18:54 +0100 Subject: [PATCH] Add controlled, translatable list of phone types --- l18n | 2 +- src/MDPhoneTypesSet.php | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/MDPhoneTypesSet.php diff --git a/l18n b/l18n index 7d645af..b4a7e98 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit 7d645afa2b7b6c88066adb4d76d79107635f55ab +Subproject commit b4a7e9865492c6a68063e4af1d60ccd5a2b9f1c8 diff --git a/src/MDPhoneTypesSet.php b/src/MDPhoneTypesSet.php new file mode 100644 index 0000000..0e73dd3 --- /dev/null +++ b/src/MDPhoneTypesSet.php @@ -0,0 +1,52 @@ + + */ +declare(strict_types = 1); + +/** + * Class containing available place types. + */ +final class MDPhoneTypesSet extends MDValueSet { + + const PHONE_TYPES = [ + 'work', + 'home', + 'mobile', + 'work mobile', + 'fax', + 'fax work', + ]; + + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + return parent::getTlUnsortedList($tlLoader, self::PHONE_TYPES, "phone_types", "phone_types"); + + } + + /** + * 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::PHONE_TYPES, "phone_types", "phone_types"); + + } +}