1: <?php
2:
3: namespace Mapbender\WmsBundle\Form\Type;
4:
5: use Symfony\Component\Form\AbstractType;
6: use Symfony\Component\Form\FormBuilderInterface;
7: use Symfony\Component\OptionsResolver\OptionsResolverInterface;
8: use Mapbender\WmsBundle\Form\EventListener\FieldSubscriber;
9:
10: 11: 12:
13: class WmsInstanceLayerType extends AbstractType
14: {
15:
16: 17: 18:
19: public function getName()
20: {
21: return 'wmsinstancelayer';
22: }
23:
24: 25: 26:
27: public function setDefaultOptions(OptionsResolverInterface $resolver)
28: {
29: $resolver->setDefaults(array(
30: 'num_layers' => 0));
31: }
32:
33: 34: 35:
36: public function buildForm(FormBuilderInterface $builder, array $options)
37: {
38: $subscriber = new FieldSubscriber($builder->getFormFactory());
39: $builder->addEventSubscriber($subscriber);
40: $builder->add('title', 'text',
41: array(
42: 'required' => false))
43: ->add('active', 'checkbox',
44: array(
45: 'required' => false))
46: ->add('selected', 'checkbox',
47: array(
48: 'required' => false))
49: ->add('info', 'checkbox',
50: array(
51: 'required' => false,
52: 'disabled' => true))
53: ->add('toggle', 'checkbox',
54: array(
55: 'required' => false))
56: ->add('allowselected', 'checkbox',
57: array(
58: 'required' => false))
59: ->add('allowinfo', 'checkbox',
60: array(
61: 'required' => false,
62: 'disabled' => true))
63: ->add('allowtoggle', 'checkbox',
64: array(
65: 'required' => false))
66: ->add('allowreorder', 'checkbox',
67: array(
68: 'required' => false))
69: ->add('minScale', 'text',
70: array(
71: 'required' => false))
72: ->add('maxScale', 'text',
73: array(
74: 'required' => false))
75: ->add('style', 'choice',
76: array(
77: 'label' => 'style',
78: 'choices' => array(),
79: 'required' => false));
80: }
81:
82: }
83: