enum fix, create form wip

This commit is contained in:
2025-04-01 16:33:50 +00:00
parent 0cd00c641b
commit 8f0e319a63
12 changed files with 74 additions and 21 deletions

View File

@@ -69,6 +69,14 @@ class GenerateJSEnums extends Command
$js .= "\n";
}
if (method_exists($enum, 'getDescription')) {
$values = $enum::toArray();
$descriptions = array_map(fn($key) => $enum::getDescription($key), $values);
$js .= 'export const DescriptionMap = ';
$js .= json_encode($descriptions, JSON_PRETTY_PRINT) . "\n";
$js .= "\n";
}
if (method_exists($enum, 'colours')) {
$colours = $enum::colours();
$js .= 'export const ColourMap = ';