Author: Adam Piotrowski (adam@wellcommerce.org)
Inheritance: extends Symfony\Component\EventDispatcher\Event
 /**
  * Adds theme configuration fields to main theme edit form
  *
  * @param FormEvent $event
  */
 public function onThemeFormInit(FormEvent $event)
 {
     $builder = $event->getFormBuilder();
     $resource = $event->getEntity();
     $fieldGenerator = $this->container->get('theme.fields_generator');
     $fieldGenerator->loadThemeFieldsConfiguration($resource);
     $fieldGenerator->addFormFields($builder);
 }
 /**
  * Adds configurator fields to main layout box edit form.
  * Loops through all configurators, renders the fieldset and sets default data
  *
  * @param FormEvent $event
  */
 public function onLayoutBoxFormInit(FormEvent $event)
 {
     $builder = $event->getFormBuilder();
     $form = $event->getForm();
     $configurators = $this->container->get('layout_box.configurator.collection')->all();
     $resource = $event->getResource();
     $boxSettings = $resource->getSettings();
     foreach ($configurators as $configurator) {
         if ($configurator instanceof LayoutBoxConfiguratorInterface) {
             $defaults = [];
             if ($resource->getBoxType() == $configurator->getType()) {
                 $defaults = $boxSettings;
             }
             $configurator->addFormFields($builder, $form, $defaults);
         }
     }
 }