From c1bba7648f8353dc8e8b88341c4c99cddd7a5675 Mon Sep 17 00:00:00 2001 From: Mart Kop Date: Thu, 5 Sep 2024 08:10:05 +0200 Subject: [PATCH] KUN-8981 | (fix) set internal as default option --- .../Form/DataTransformer/URLChooserToLinkTransformer.php | 2 +- .../NodeBundle/Form/Type/InternalURLSelectorType.php | 4 ++-- src/Kunstmaan/NodeBundle/Form/Type/URLTypeType.php | 2 +- .../Resources/views/Form/formWidgets.html.twig | 9 ++++----- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Kunstmaan/NodeBundle/Form/DataTransformer/URLChooserToLinkTransformer.php b/src/Kunstmaan/NodeBundle/Form/DataTransformer/URLChooserToLinkTransformer.php index 302343f5b9..e85166ace6 100644 --- a/src/Kunstmaan/NodeBundle/Form/DataTransformer/URLChooserToLinkTransformer.php +++ b/src/Kunstmaan/NodeBundle/Form/DataTransformer/URLChooserToLinkTransformer.php @@ -25,7 +25,7 @@ public function transform($value): array if ($value === null) { return [ - 'link_type' => URLChooserType::EXTERNAL, + 'link_type' => URLChooserType::INTERNAL, 'link_url' => null, ]; } diff --git a/src/Kunstmaan/NodeBundle/Form/Type/InternalURLSelectorType.php b/src/Kunstmaan/NodeBundle/Form/Type/InternalURLSelectorType.php index f783272c9d..502cadc9bd 100644 --- a/src/Kunstmaan/NodeBundle/Form/Type/InternalURLSelectorType.php +++ b/src/Kunstmaan/NodeBundle/Form/Type/InternalURLSelectorType.php @@ -11,7 +11,7 @@ class InternalURLSelectorType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('input', HiddenType::class, [ 'label' => false, @@ -23,7 +23,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'internal_url_selector'; } diff --git a/src/Kunstmaan/NodeBundle/Form/Type/URLTypeType.php b/src/Kunstmaan/NodeBundle/Form/Type/URLTypeType.php index f3b01eff9c..78a66245f8 100644 --- a/src/Kunstmaan/NodeBundle/Form/Type/URLTypeType.php +++ b/src/Kunstmaan/NodeBundle/Form/Type/URLTypeType.php @@ -19,7 +19,7 @@ public function configureOptions(OptionsResolver $resolver): void $resolver->setAllowedTypes('choices', 'array'); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['choices'] = $options['choices']; } diff --git a/src/Kunstmaan/NodeBundle/Resources/views/Form/formWidgets.html.twig b/src/Kunstmaan/NodeBundle/Resources/views/Form/formWidgets.html.twig index 4c5b9d5b83..381bbdff56 100644 --- a/src/Kunstmaan/NodeBundle/Resources/views/Form/formWidgets.html.twig +++ b/src/Kunstmaan/NodeBundle/Resources/views/Form/formWidgets.html.twig @@ -60,17 +60,16 @@ - - + + {% else %} {% endif %} - {% else %} {% set linkUrl = form.link_url.vars %}