Fixed CurrencyEntityType

This commit is contained in:
Jan Böhmer 2023-01-29 19:27:51 +01:00
parent 8d5427a1c3
commit 672d55624f
5 changed files with 59 additions and 8 deletions

View file

@ -75,6 +75,29 @@ class CurrencyEntityType extends StructuralEntityType
$resolver->setDefault('short', false);
}
protected function generateChoiceAttr(AbstractStructuralDBElement $choice, $key, $value, $options): array
{
$tmp = parent::generateChoiceAttr($choice, $key, $value, $options);
if(!empty($choice->getIsoCode())) {
$symbol = Currencies::getSymbol($choice->getIsoCode());
} else {
$symbol = null;
}
if ($options['short']) {
$tmp['data-short'] = $symbol;
} else {
$tmp['data-short'] = $choice->getName();
}
$tmp += [
'data-symbol' => $symbol,
];
return $tmp;
}
protected function getChoiceContent(AbstractStructuralDBElement $choice, $key, $value, $options): string
{
if(!$choice instanceof Currency) {

View file

@ -104,7 +104,7 @@ class StructuralEntityType extends AbstractType
'data-controller' => $options['controller'],
];
if ($options['empty_message']) {
$tmp['data-empty_message'] = $options['empty_message'];
$tmp['data-empty-message'] = $options['empty_message'];
}
return $tmp;