Skip to content

Commit

Permalink
Merge branch 'MAUT-11616' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuld-dev committed Jul 8, 2024
2 parents c204339 + a57e274 commit be2ec94
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions Form/Type/CampaignConditionFieldValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,19 @@ public function __construct(
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$fields = $this->customFieldModel->fetchCustomFieldsForObject($options['customObject']);
$choices = [];
$fields = $this->customFieldModel->fetchCustomFieldsForObject($options['customObject']);
$choices = [];
$optionAttr = [];

foreach ($fields as $field) {
$choices[$field->getLabel()] = $field->getId();
$choices[$field->getLabel()] = $field->getId();
$optionAttr[$field->getLabel()] = [
'data-operators' => json_encode($field->getTypeObject()->getOperatorOptions()),
'data-options' => json_encode($field->getChoices()),
'data-field-type' => $field->getType(),
];
}

$optionAttr = array_combine(
array_map(fn ($field) => $field->getLabel(), $fields),
array_map(
function ($field) {
return [
'data-operators' => json_encode($field->getTypeObject()->getOperatorOptions()),
'data-options' => json_encode($field->getChoices()),
'data-field-type' => $field->getType(),
];
},
$fields
)
);

$builder->add(
'field',
ChoiceType::class,
Expand Down

0 comments on commit be2ec94

Please sign in to comment.