2020-08-06 11:08:10 +02:00
|
|
|
<?PHP
|
|
|
|
/**
|
|
|
|
* Contains a class for controlling the list of available units.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
*/
|
2020-08-07 00:12:49 +02:00
|
|
|
declare(strict_types = 1);
|
2020-08-06 11:08:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class containing available units for weights, lengths etc.
|
|
|
|
*/
|
2020-08-07 10:18:10 +02:00
|
|
|
class MDUnitsSet extends MDValueSet {
|
2020-08-06 11:08:10 +02:00
|
|
|
|
|
|
|
const UNITS_LENGTH = ['', 'm', 'dm', 'cm', 'mm'];
|
|
|
|
const UNITS_WEIGHT = ['', 't', 'kg', 'g'];
|
|
|
|
|
2020-08-07 10:18:10 +02:00
|
|
|
/**
|
|
|
|
* Returns a translated list of length units.
|
|
|
|
*
|
|
|
|
* @param MDTlLoader $tlLoader Translation loader.
|
|
|
|
*
|
|
|
|
* @return array<string>
|
|
|
|
*/
|
|
|
|
function getLengthUnitsTLed(MDTlLoader $tlLoader):array {
|
|
|
|
return parent::getTlUnsortedList($tlLoader, self::UNITS_LENGTH, "units_length_set", "units_length_set");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a translated list of weight units.
|
|
|
|
*
|
|
|
|
* @param MDTlLoader $tlLoader Translation loader.
|
|
|
|
*
|
|
|
|
* @return array<string>
|
|
|
|
*/
|
|
|
|
function getWeightUnitsTLed(MDTlLoader $tlLoader):array {
|
|
|
|
return parent::getTlUnsortedList($tlLoader, self::UNITS_WEIGHT, "units_weight_set", "units_weight_set");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-08-06 11:08:10 +02:00
|
|
|
}
|