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: use Mapbender\CoreBundle\Form\EventListener\PrintClientSubscriber;
9:
10: 11: 12:
13: class PrintClientAdminType extends AbstractType
14: {
15:
16: 17: 18:
19: public function getName()
20: {
21: return 'printclient';
22: }
23:
24: 25: 26:
27: public function setDefaultOptions(OptionsResolverInterface $resolver)
28: {
29: $resolver->setDefaults(array(
30: 'application' => null
31: ));
32: }
33:
34: 35: 36:
37: public function buildForm(FormBuilderInterface $builder, array $options)
38: {
39: $subscriber = new PrintClientSubscriber($builder->getFormFactory(), $options["application"]);
40: $builder->addEventSubscriber($subscriber);
41: $builder->add('target', 'target_element',
42: array(
43: 'element_class' => 'Mapbender\\CoreBundle\\Element\\Map',
44: 'application' => $options['application'],
45: 'property_path' => '[target]',
46: 'required' => false))
47: ->add('autoOpen', 'checkbox',
48: array(
49: 'required' => false))
50: ->add('print_directly', 'checkbox',
51: array(
52: 'required' => false))
53: ->add('scales', 'text', array('required' => false))
54: ->add('rotatable', 'checkbox',
55: array(
56: 'required' => false))
57: ->add('optional_fields', 'text', array('required' => false));
58: }
59:
60: }