Add controlled, translatable list of phone types
This commit is contained in:
		
							
								
								
									
										2
									
								
								l18n
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								l18n
									
									
									
									
									
								
							 Submodule l18n updated: 7d645afa2b...b4a7e98654
									
								
							
							
								
								
									
										52
									
								
								src/MDPhoneTypesSet.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/MDPhoneTypesSet.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| <?PHP | ||||
| /** | ||||
|  * Contains a class for controlling the list of available phone types. | ||||
|  * Phone types (e.g. mobile, work, fax) are mainly used for contact pages in | ||||
|  * musdb. | ||||
|  * The list aims to be roughly similar to common implementations of the vCard standard. | ||||
|  * | ||||
|  * @see https://tools.ietf.org/html/rfc2426 | ||||
|  * @see https://tools.ietf.org/html/rfc6350 | ||||
|  * | ||||
|  * @author Joshua Ramon Enslin <joshua@museum-digital.de> | ||||
|  */ | ||||
| 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<string> | ||||
|      */ | ||||
|     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<string> | ||||
|      */ | ||||
|     public static function getSortedList(MDTlLoader $tlLoader):array { | ||||
|         return parent::getTlSortedList($tlLoader, self::PHONE_TYPES, "phone_types", "phone_types"); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user