Add MDAppointmentImageCategory

See museum-digital/musdb#1526
This commit is contained in:
2026-05-31 18:00:58 +02:00
parent bb4640ae2c
commit c693fff212
2 changed files with 94 additions and 5 deletions
+94
View File
@@ -0,0 +1,94 @@
<?PHP
declare(strict_types = 1);
/**
* Represents a type of appointment documentation image.
*/
enum MDAppointmentImageCategory implements MDValueEnumInterface, JsonSerializable {
case advertising_material;
case photo_documentation;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDAppointmentImageCategory
*/
public static function fromString(string $input):MDAppointmentImageCategory {
return match($input) {
'advertising_material' => self::advertising_material,
'photo_documentation' => self::photo_documentation,
default => throw new MDpageParameterNotFromListException("Unknown attendance status"),
};
}
/**
* Lists all available names.
*
* @return array<string>
*/
public static function caseNames():array {
$output = [];
$cases = self::cases();
foreach ($cases as $case) {
$output[] = $case->name;
}
return $output;
}
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string, string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "appointment_image_category", "appointment_image_category");
}
/**
* Gets a sorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string, string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "appointment_image_category", "appointment_image_category");
}
/**
* Returns the name of the current value in translation.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return string
*/
public function getTledName(MDTlLoader $tlLoader):string {
return $tlLoader->tl("appointment_image_category", "appointment_image_category", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}
-5
View File
@@ -1,9 +1,4 @@
<?PHP
/**
* Represents a type of attendance status for events / appointments: offline or online.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**