Skip to content

Commit e373893

Browse files
committed
bug #7240 setDefaultColumns didn't work on ChoiceField if CustomOption Widget Autocomplete is set (Patrick Perry)
This PR was merged into the 4.x branch. Discussion ---------- setDefaultColumns didn't work on ChoiceField if CustomOption Widget Autocomplete is set fix #7239 just check if value is not set before, to avoid breaking projects that specifically rely on the classes. An alternative would be to delete the line. Commits ------- 9e3cfe2 check if already a defaultColumns exist before overwritting customized one.
2 parents a3d5f3d + 9e3cfe2 commit e373893

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Field/Configurator/ChoiceConfigurator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
9494

9595
if (ChoiceField::WIDGET_AUTOCOMPLETE === $field->getCustomOption(ChoiceField::OPTION_WIDGET)) {
9696
$field->setFormTypeOption('attr.data-ea-widget', 'ea-autocomplete');
97-
$field->setDefaultColumns($isMultipleChoice ? 'col-md-8 col-xxl-6' : 'col-md-6 col-xxl-5');
97+
if ('' === $field->getDefaultColumns()) {
98+
$field->setDefaultColumns($isMultipleChoice ? 'col-md-8 col-xxl-6' : 'col-md-6 col-xxl-5');
99+
}
98100
}
99101

100102
$field->setFormTypeOptionIfNotSet('placeholder', '');

0 commit comments

Comments
 (0)