Form/Items/ChoiceItem.php
public static function getItem(FormBuilderInterface $builder, array $item)
    {
        $attributes = [];

        if (isset($item['read_only']) && $item['read_only']) {
            $attributes['readonly'] = true;
        }

        if (isset($item['twig_variable']) && $item['twig_variable']) {
            $attributes['twig_variable'] = $item['twig_variable'];
        }

        if (isset($item['popover']) && trim($item['popover'])) {
            $attributes['data-toggle'] = 'popover';
            $attributes['data-placement'] = 'top';
            $attributes['data-trigger'] = 'focus';
            $attributes['data-html'] = 'true';
            $attributes['data-content'] = $item['popover'];
        }

        $choices = explode("\n", $item['choices']);

        // TODO: array map.
        $parsedChoices = [];
        foreach ($choices as $key => $line) {
            if (false !== strpos($line, '|')) {
                [$key, $label] = explode('|', $line);
            } else {
                $label = $line;
                $key = $line;
            }

            $parsedChoices[trim((string) $label)] = trim((string) $key);
        }

        $options = [
            'label' => !empty($item['hideLabel']) && $item['hideLabel'] ? false : $item['label'],
            'required' => $item['required'] ?? false,
            'attr' => $attributes,
            'choices' => $parsedChoices,
            'expanded' => $item['expanded'] ?? false,
            'multiple' => $item['multiple'] ?? false,
            'placeholder' => $item['placeholder'] ?? $item['label'],
        ];

        if ($item['expanded']) {
            if ($item['multiple']) {
                $options['label_attr'] = [
                    'class' => 'checkbox-custom',
                ];
            } else {
                $options['label_attr'] = [
                    'class' => 'radio-custom',
                ];
            }
        } elseif (!$item['multiple'])  {
            $options['attr']['class'] = 'custom-select '.($options['attr']['class'] ?? '');
        }


        if (isset($item['required']) && $item['required']) {
            $options['constraints'] = new NotBlank();
        }

        $builder->add($item['name'], ChoiceType::class, $options);
    }
public static function getItem(FormBuilderInterface $builder, array $item)
    {
        $attributes = [];

        if (isset($item['read_only']) && $item['read_only']) {
            $attributes['readonly'] = true;
        }

        if (isset($item['twig_variable']) && $item['twig_variable']) {
            $attributes['twig_variable'] = $item['twig_variable'];
        }

        if (isset($item['popover']) && trim($item['popover'])) {
            $attributes['data-toggle'] = 'popover';
            $attributes['data-placement'] = 'top';
            $attributes['data-trigger'] = 'focus';
            $attributes['data-html'] = 'true';
            $attributes['data-content'] = $item['popover'];
        }

        $choices = explode("\n", $item['choices']);

        // TODO: array map.
        $parsedChoices = [];
        foreach ($choices as $key => $line) {
            if (false !== strpos($line, '|')) {
                [$key, $label] = explode('|', $line);
            } else {
                $label = $line;
                $key = $line;
            }

            $parsedChoices[trim((string) $label)] = trim((string) $key);
        }

        $options = [
            'label' => !empty($item['hideLabel']) && $item['hideLabel'] ? false : $item['label'],
            'required' => $item['required'] ?? false,
            'attr' => $attributes,
            'choices' => $parsedChoices,
            'expanded' => $item['expanded'] ?? false,
            'multiple' => $item['multiple'] ?? false,
            'placeholder' => $item['placeholder'] ?? $item['label'],
        ];

        if ($item['expanded']) {
            if ($item['multiple']) {
                $options['label_attr'] = [
                    'class' => 'checkbox-custom',
                ];
            } else {
                $options['label_attr'] = [
                    'class' => 'radio-custom',
                ];
            }
        } elseif (!$item['multiple'])  {
            $options['attr']['class'] = 'custom-select '.($options['attr']['class'] ?? '');
        }


        if (isset($item['required']) && $item['required']) {
            $options['constraints'] = new NotBlank();
        }

        $builder->add($item['name'], ChoiceType::class, $options);
    }
{@inheritdoc}