@@ -34,13 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
34
34
->add ('linkType ' , 'choice ' , array (
35
35
'label ' => 'form.link_type.linkType.label ' ,
36
36
'required ' => true ,
37
- 'choices ' => array (
38
- 'none ' => 'form.link_type.linkType.none ' ,
39
- 'viewReference ' => 'form.link_type.linkType.view_reference ' ,
40
- 'route ' => 'form.link_type.linkType.route ' ,
41
- 'url ' => 'form.link_type.linkType.url ' ,
42
- 'attachedWidget ' => 'form.link_type.linkType.widget ' ,
43
- ),
37
+ 'choices ' => $ options ['linkTypeChoices ' ],
44
38
'attr ' => array (
45
39
'data-role ' => 'vic-linkType-select ' ,
46
40
'onchange ' => 'showSelectedLinkType($vic(this)); ' ,
@@ -119,9 +113,24 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
119
113
'data_class ' => 'Victoire\Bundle\CoreBundle\Entity\Link ' ,
120
114
'translation_domain ' => 'victoire ' ,
121
115
'horizontal ' => false ,
116
+ 'linkTypeChoices ' => $ this ->getDefaultLinkTypeChoices ()
122
117
));
123
118
}
124
119
120
+ /**
121
+ * @return array
122
+ */
123
+ public static function getDefaultLinkTypeChoices ()
124
+ {
125
+ return array (
126
+ 'none ' => 'form.link_type.linkType.none ' ,
127
+ 'viewReference ' => 'form.link_type.linkType.view_reference ' ,
128
+ 'route ' => 'form.link_type.linkType.route ' ,
129
+ 'url ' => 'form.link_type.linkType.url ' ,
130
+ 'attachedWidget ' => 'form.link_type.linkType.widget ' ,
131
+ );
132
+ }
133
+
125
134
/**
126
135
* {@inheritdoc}
127
136
*/
0 commit comments