Skip to content

Commit

Permalink
ListField::registerFromEnums() if no title, show value or key name #985
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed Sep 11, 2022
1 parent 224ac2c commit a57c428
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/form/src/Field/Concern/ListOptionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function registerFromEnums(iterable|string $enums, ?LanguageInterface $la

foreach ($enums as $enum) {
if ($enum instanceof EnumTranslatableInterface) {
$options[$enum->getValue()] = $enum->getTitle($lang);
$options[$enum->getValue()] = $enum->getTitle($lang) ?: $enum->getKey();
} elseif ($enum instanceof Enum) {
$options[$enum->getValue()] = $enum->getKey();
} elseif ($enum instanceof \UnitEnum) {
Expand Down

0 comments on commit a57c428

Please sign in to comment.