Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 5.3.0
- **[IMPROVEMENT]** New field added to `form_builder_form_attributes`: `autocomplete`
- **[BUGFIX]** Solidify check for empty value in output transformer [#486](https://github.com/dachcom-digital/pimcore-formbuilder/issues/508)

## 5.2.0
- **[LICENSE]** Dual-License with GPL and Dachcom Commercial License (DCL) added
Expand Down
10 changes: 5 additions & 5 deletions src/Transformer/Output/FallbackTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function parseDynamicField(FormFieldDynamicDefinitionInterface $field,

protected function parseDefaultField(mixed $value, FormInterface $formField, ?string $locale): mixed
{
if (empty($value)) {
if ($value === null || $value === '') {
return $value;
}

Expand Down Expand Up @@ -164,15 +164,15 @@ protected function parseDynamicLabel(FormFieldDynamicDefinitionInterface $field,
$label = $formField->getConfig()->hasOption('label') ? $formField->getConfig()->getOption('label') : $field->getName();
$optionalOptions = $field->getOptional();

$emailLabel = isset($optionalOptions['email_label']) && !empty($optionalOptions['email_label'])
$emailLabel = !empty($optionalOptions['email_label'])
? $this->translator->trans($optionalOptions['email_label'], [], null, $locale)
: null;

if (!empty($emailLabel)) {
return $emailLabel;
}

return isset($label) && !empty($label)
return !empty($label)
? $this->translator->trans($label, [], null, $locale)
: $label;
}
Expand All @@ -186,15 +186,15 @@ protected function parseDefaultLabel(FieldDefinitionInterface $field, ?string $l
$fieldOptions = $field->getOptions();
$optionalOptions = $field->getOptional();

$emailLabel = isset($optionalOptions['email_label']) && !empty($optionalOptions['email_label'])
$emailLabel = !empty($optionalOptions['email_label'])
? $this->translator->trans($optionalOptions['email_label'], [], null, $locale)
: null;

if (!empty($emailLabel)) {
return $emailLabel;
}

return isset($fieldOptions['label']) && !empty($fieldOptions['label'])
return !empty($fieldOptions['label'])
? $this->translator->trans($fieldOptions['label'], [], null, $locale)
: $field->getName();
}
Expand Down