protected function manageLinkTypeRelatedFields($linkType, $locale, $form, FormBuilderInterface $builder, $options)
    {
        $form->remove('route');
        $form->remove('url');
        $form->remove('attachedWidget');
        $form->remove('viewReference');
        $form->remove('locale');
        $this->addTargetField($form, $options);
        switch ($linkType) {
            case Link::TYPE_VIEW_REFERENCE:
                $locale = $locale ?: $this->requestStack->getCurrentRequest()->getLocale();
                $form->add('viewReference', ChoiceType::class, [
                    'label'                          => 'form.link_type.view_reference.label',
                    'required'                       => true,
                    'attr'                           => ['novalidate' => 'novalidate'],
                    'placeholder'                    => 'form.link_type.view_reference.blank',
                    'choices'                        => $this->viewReferenceRepository->getChoices($locale),
                    'choices_as_values'              => true,
                    'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'],
                ])->add('locale', ChoiceType::class, [
                    'label'   => 'form.link_type.locale.label',
                    'choices' => array_combine($this->availableLocales, $this->availableLocales),
                    'attr'    => [
                        'data-refreshOnChange' => 'true',
                        'data-target'          => $options['refresh-target'],
                    ],
                ]);
                break;
            case Link::TYPE_ROUTE:
                $form->add('route', null, [
                    'label'                          => 'form.link_type.route.label',
                    'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'],
                    'required'                       => true,
                    'attr'                           => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.route.placeholder'],
                ])
                    ->add('route_parameters', JsonType::class, [
                        'label'                          => 'form.link_type.route_parameters.label',
                        'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'],
                        'required'                       => true,
                        'attr'                           => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.route_parameters.placeholder'],
                    ]);
                break;
            case Link::TYPE_URL:
                $form->add('url', null, [
                    'label'                          => 'form.link_type.url.label',
                    'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'],
                    'required'                       => true,
                    'attr'                           => ['novalidate' => 'novalidate', 'placeholder' => 'form.link_type.url.placeholder'],
                ]);
                break;
            case Link::TYPE_WIDGET:
                $form->add('attachedWidget', EntityType::class, [
                    'label'                          => 'form.link_type.attachedWidget.label',
                    'placeholder'                    => 'form.link_type.attachedWidget.blank',
                    'class'                          => 'VictoireWidgetBundle:Widget',
                    'vic_vic_widget_form_group_attr' => ['class' => 'vic-form-group'],
                    'required'                       => true,
                    'attr'                           => ['novalidate' => 'novalidate'],
                ]);
                break;
            case Link::TYPE_NONE:
            case null:
                $form->remove('target');
                break;
        }
    }