22
33namespace Victoire \Widget \ButtonBundle \Form ;
44
5+ use Symfony \Component \Form \Extension \Core \Type \ChoiceType ;
56use Symfony \Component \Form \FormBuilderInterface ;
6- use Symfony \Component \OptionsResolver \OptionsResolverInterface ;
7+ use Symfony \Component \OptionsResolver \OptionsResolver ;
78use Victoire \Bundle \CoreBundle \Form \WidgetType ;
9+ use Victoire \Bundle \FormBundle \Form \Type \FontAwesomePickerType ;
10+ use Victoire \Bundle \FormBundle \Form \Type \LinkType ;
811
912/**
1013 * WidgetButton form type.
@@ -29,7 +32,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
2932 ->add ('hoverTitle ' , null , [
3033 'label ' => 'widget.button.form.label.hoverTitle ' ,
3134 ])
32- ->add ('size ' , ' choice ' , [
35+ ->add ('size ' , ChoiceType::class , [
3336 'label ' => 'widget.button.form.label.size ' ,
3437 'choices ' => [
3538 'md ' => 'widget.button.form.choice.size.normal ' ,
@@ -38,7 +41,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3841 ],
3942 'required ' => true ,
4043 ])
41- ->add ('style ' , ' choice ' , [
44+ ->add ('style ' , ChoiceType::class , [
4245 'label ' => 'widget.button.form.label.style ' ,
4346 'choices ' => [
4447 'default ' => 'widget.button.form.choice.style.label.default ' ,
@@ -51,7 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5154 ],
5255 'required ' => true ,
5356 ])
54- ->add ('link ' , ' victoire_link ' )
57+ ->add ('link ' , LinkType::class )
5558 ->add ('isBlock ' , null , [
5659 'label ' => 'widget.button.form.label.isBlock ' ,
5760 ])
@@ -61,34 +64,22 @@ public function buildForm(FormBuilderInterface $builder, array $options)
6164 ->add ('tooltipable ' , null , [
6265 'label ' => 'widget.button.form.label.tooltipable ' ,
6366 ])
64- ->add ('icon ' , ' font_awesome_picker ' );
67+ ->add ('icon ' , FontAwesomePickerType::class );
6568
6669 parent ::buildForm ($ builder , $ options );
6770 }
6871
6972 /**
70- * bind form to WidgetButton entity.
71- *
72- * @param OptionsResolverInterface $resolver
73+ * {@inheritdoc}
7374 */
74- public function setDefaultOptions ( OptionsResolverInterface $ resolver )
75+ public function configureOptions ( OptionsResolver $ resolver )
7576 {
76- parent ::setDefaultOptions ($ resolver );
77+ parent ::configureOptions ($ resolver );
7778
7879 $ resolver ->setDefaults ([
7980 'data_class ' => 'Victoire\Widget\ButtonBundle\Entity\WidgetButton ' ,
8081 'widget ' => 'Button ' ,
8182 'translation_domain ' => 'victoire ' ,
8283 ]);
8384 }
84-
85- /**
86- * get form name.
87- *
88- * @return string
89- */
90- public function getName ()
91- {
92- return 'victoire_widget_form_button ' ;
93- }
9485}
0 commit comments