1: <?php
2:
3: namespace Mapbender\CoreBundle\Element\Type;
4:
5: use Symfony\Component\Form\AbstractType;
6: use Symfony\Component\Form\FormBuilderInterface;
7: use Symfony\Component\OptionsResolver\OptionsResolverInterface;
8:
9: /**
10: *
11: */
12: class SearchRouterSelectType extends AbstractType
13: {
14:
15: /**
16: * @inheritdoc
17: */
18: public function getName()
19: {
20: return 'search_routes';
21: }
22:
23: /**
24: * @inheritdoc
25: */
26: public function setDefaultOptions(OptionsResolverInterface $resolver)
27: {
28: $resolver->setDefaults(array(
29: 'routes' => array()));
30: }
31:
32: /**
33: * @inheritdoc
34: */
35: public function buildForm(FormBuilderInterface $builder, array $options)
36: {
37: $routes = array();
38: foreach($options['routes'] as $name => $conf)
39: {
40: $routes[$name] = $conf['title'];
41: }
42:
43: $builder->add('route', 'choice',
44: array(
45: 'choices' => $routes,
46: 'mapped' => false,
47: 'property_path' => false,
48: 'multiple' => false,
49: 'expanded' => false));
50: }
51:
52: }
53: