Skip to content

Commit a57e274

Browse files
committed
suggessions
1 parent 367cd2e commit a57e274

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

Form/Type/CampaignConditionFieldValueType.php

+10-17
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,19 @@ public function __construct(
4646
*/
4747
public function buildForm(FormBuilderInterface $builder, array $options): void
4848
{
49-
$fields = $this->customFieldModel->fetchCustomFieldsForObject($options['customObject']);
50-
$choices = [];
49+
$fields = $this->customFieldModel->fetchCustomFieldsForObject($options['customObject']);
50+
$choices = [];
51+
$optionAttr = [];
52+
5153
foreach ($fields as $field) {
52-
$choices[$field->getLabel()] = $field->getId();
54+
$choices[$field->getLabel()] = $field->getId();
55+
$optionAttr[$field->getLabel()] = [
56+
'data-operators' => json_encode($field->getTypeObject()->getOperatorOptions()),
57+
'data-options' => json_encode($field->getChoices()),
58+
'data-field-type' => $field->getType(),
59+
];
5360
}
5461

55-
$optionAttr = array_combine(
56-
array_map(fn ($field) => $field->getLabel(), $fields),
57-
array_map(
58-
function ($field) {
59-
return [
60-
'data-operators' => json_encode($field->getTypeObject()->getOperatorOptions()),
61-
'data-options' => json_encode($field->getChoices()),
62-
'data-field-type' => $field->getType(),
63-
];
64-
},
65-
$fields
66-
)
67-
);
68-
6962
$builder->add(
7063
'field',
7164
ChoiceType::class,

0 commit comments

Comments
 (0)