Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • DrupalIntegrationBundle
      • DependencyInjection
      • Security
        • Authentication
          • Provider
          • Token
        • Authorization
          • Voter
        • Factory
        • Firewall
        • User
      • Session
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • EventListener
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • WmcFieldSubscriber
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: namespace Mapbender\WmcBundle\Form\EventListener;
 4: 
 5: use Mapbender\CoreBundle\Entity\State;
 6: use Symfony\Component\Form\Event\DataEvent;
 7: use Symfony\Component\Form\FormFactoryInterface;
 8: use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 9: use Symfony\Component\Form\FormEvents;
10: 
11: /**
12:  * 
13:  */
14: class WmcFieldSubscriber implements EventSubscriberInterface
15: {
16: 
17:     /**
18:      * @inheritdoc
19:      */
20:     public function __construct(FormFactoryInterface $factory)
21:     {
22:         
23:     }
24: 
25:     /**
26:      * @inheritdoc
27:      */
28:     public static function getSubscribedEvents()
29:     {
30:         return array(
31:             FormEvents::PRE_SET_DATA => 'preSetData',
32:             FormEvents::PRE_BIND => 'preBind');
33:     }
34: 
35:     /**
36:      * Checkt form fields by PRE_BIND DataEvent
37:      * 
38:      * @param DataEvent $event
39:      */
40:     public function preBind(DataEvent $event)
41:     {
42:         $data = $event->getData();
43: 
44:         if(null === $data)
45:         {
46:             return;
47:         }
48:         if(key_exists("state", $data) && strlen($data["state"]) > 0)
49:         {
50:             $state = new State();
51:             $state->setJson(json_decode($data["state"]));
52:             $data["state"] = $state;
53:             $event->setData($data);
54:         }
55:     }
56: 
57:     /**
58:      * Checkt form fields by PRE_SET_DATA DataEvent
59:      * 
60:      * @param DataEvent $event
61:      */
62:     public function preSetData(DataEvent $event)
63:     {
64:         $data = $event->getData();
65:         if(null === $data)
66:         {
67:             return;
68:         }
69:     }
70: 
71: }
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0