Centralize getSortedList in parent class
This commit is contained in:
35
src/MDValueSet.php
Normal file
35
src/MDValueSet.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?PHP
|
||||
/**
|
||||
* Parent class for controlled lists of available values at md.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generic class for value sets.
|
||||
*/
|
||||
class MDValueSet {
|
||||
|
||||
/**
|
||||
* Gets a list of entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
* @param array<string> $keyList List of keys to get translations for.
|
||||
* @param string $tlFileName Name of the translation file.
|
||||
* @param string $tlVarName Variable of the translation.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function getSortedList(MDTlLoader $tlLoader, array $keyList, string $tlFileName, string $tlVarName):array {
|
||||
|
||||
$output = [];
|
||||
foreach ($keyList as $tID) {
|
||||
$output[$tID] = $tlLoader->tl($tlFileName, $tlVarName, $tID);
|
||||
}
|
||||
|
||||
asort($output);
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user