Skip to content

Commit 43f310d

Browse files
committed
Merge pull request #215 from Charlie-Lucas/master
use an option to set links available
2 parents 42139b3 + 1a4ff78 commit 43f310d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Bundle/FormBundle/Form/Type/LinkType.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3434
->add('linkType', 'choice', array(
3535
'label' => 'form.link_type.linkType.label',
3636
'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'],
4438
'attr' => array(
4539
'data-role' => 'vic-linkType-select',
4640
'onchange' => 'showSelectedLinkType($vic(this));',
@@ -119,9 +113,24 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
119113
'data_class' => 'Victoire\Bundle\CoreBundle\Entity\Link',
120114
'translation_domain' => 'victoire',
121115
'horizontal' => false,
116+
'linkTypeChoices' => $this->getDefaultLinkTypeChoices()
122117
));
123118
}
124119

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+
125134
/**
126135
* {@inheritdoc}
127136
*/

0 commit comments

Comments
 (0)